CentOS 7.0 modify hostname
In centos, you can modify the hostname temporarily or permanently. Temporary modification does not require a restart and takes effect immediately.
Temporarily modify hostname
# Hostname // view the current hostname # hostname newname // temporarily modify the hostname
Permanent modification of hostname
To permanently modify the hostname, You need to modify the file,man hostname
Check the user manual,
Set name When called with one argument or with--Fileoption, the commands set the host name or the NIS/YP domain name.HostnameusesSethostname (2) function, while all of the threeDomainname,Ypdomain-nameandNisdomainnameuseSetdomainname (2). Note, that this is effec-tive only until the next reboot. Edit/Etc/hostnamefor permanent change.
If you want to modify the hostname permanently, you can modify it/etc/hostname
File. Use vim to replace the hostname in the file with the value to be modified.
Note: If you want to permanently modify the RedHat hostname, modify the/etc/sysconfig/network file and change the HOSTNAME line to HOSTNAME = NEWNAME. NEWNAME is the hostname you want to set.