Changing the hostname

A hostname is the unique name by which a network attached device is known on a network.

If you enter the wrong hostname during the installation, and you need to change the hostname, here is the solution:-

Edit file /etc/sysconfig/network using your favourite editor. In my case is vi. So i’ll enter vi /etc/sysconfig/network

Look for HOSTNAME=xxxxxx

Change the xxxx to the name you wish to set for your computer. (ex: HOSTNAME=myserver.mydomain.com)

Save the file and restart the xinetd service. (ex: type service xinetd restart or /etc/init.d/xinetd restart in your shell)

You might get an error if xinetd is not installed on your server you can install this with

yum install xinetd

Now run the restart command and your server hostname should now been updated.

Done! You have just changed your hostname in Linux platform


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 9347