Centos Change Hostname

CENTOS 6:
Edit /etc/sysconfig/network
change the line:

HOSTNAME=app01.localdomain

Edit /etc/hosts
add hostname to the end of line:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 app01

Run hostname setting on the shell:

# hostname app01.localdomain

CENTOS 7:

hostnamectl set-hostname newhostname

Run the below command to ensure hostname is changed:

hostnamectl status

Be the first to comment

Leave a Reply

Your email address will not be published.


*