How to change hostname on CentOS 7?

HostStud

Administrator
Staff member
To view the current hostname, enter the following command:

# hostnamectl
In CentOS 7 to change the hostname and use the command hostnamectl
# hostnamectl set-hostname server.domain.com
Manual method to setup a CentOS 7 hostname is to edit the /etc/hostname file and type your new hostname
# vi /etc/hostname
System reboot is necessary to apply new hostname.
 
Top