Contents
  1. 1. Amazon Linux 2

Amazon Linux 2

Change hostname use init-cloud:

1
2
3
4
5
6
vim /etc/cloud/cloud.cfg.d/11_changehostname.cfg
#cloud-config
preserve_hostname: false
hostname: myhostname
fqdn: myhostname.example.com
manage_etc_hosts: true

By Command:

1
2
hostnamectl set-hostname foobar.localdomain
sed -i '1s/localhost/foobar/1' /etc/hosts|sed -i '1s/localhost/foobar/2' /etc/hosts

Extra Library:

1
2
[ec2-user ~]$ amazon-linux-extras list
[ec2-user ~]$ sudo amazon-linux-extras install topic=version topic=version
Contents
  1. 1. Amazon Linux 2