June 8, 2013

How to Set Hostname on RHEL 6

Hostname is usually set when installing the machine, but sometime you need to change it.

To print current hostname

$ hostname
server1.example.com

To temporarily change the hostname.

$ hostname server99.example.com

To permanently change the hostname, edit the /etc/sysconfig/network and set the HOSTNAME property.

$NETWORKING=yes
HOSTNAME=server99.example.com

After saving the configuration, you will need to reboot your machine.

No comments: