[Linux] Linux operating system ---- modify the host name

Environment: CentOS 6.5

 

method one:

1. Modify the hosts file

vi /etc/hosts

The ip addresses behind the machine to get rid hostname

 

2. Modify the network file

vi /etc/sysconfig/network

The value of HOSTNAME to the new hostname

3. Restart the server

reboot

 

Second way:

Direct use the command

hostnamectl set-hostname 新主机名

 

Guess you like

Origin blog.csdn.net/ningjiebing/article/details/89410995