I’ll introduce how to change the hostname in Linux.
As an example, let’s say we want to set the server hostname to codenote.net.
# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
↓(Add)
127.0.0.1 codenote.net localhost localhost.localdomain localhost4 localhost4.localdomain4
# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
↓(Change)
NETWORKING=yes
HOSTNAME=condenote.net
If there are no particular issues, let’s restart the server.
# reboot -h now
If you don’t mind the console hostname, just restarting the network is OK.
# service network restart
That’s all from the Gemba.