How to Change Hostname on CentOS 5.8

Share this Article :

In this post, i will show you the basic guides on how to change the hostname on linux CentOS 5.8 server. Assumed that you have root account access on this CentOS server and this steps may working on RHEL 6, RHEl 5, CentOS 5.5, CentOS 5.6, CentOS 5.7, CentOS 6.0, CentOS 6.1 and CentOS 6.2.

1. Check current hostname :

[[email protected] ~]# hostname

2. Modify “/etc/sysconfig/network” to change hostname :

[[email protected] ~]# vi /etc/sysconfig/network

Change the hostname to the following :


Alternatively, you can execute the following command :

[[email protected] ~]# hostname centos58.ehowtuff.local

3. Change host file :

[[email protected] ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6 centos58.ehowstuff.local centos58

4. Reboot the server.

[[email protected] ~]# reboot

Like this Article? Subscribe to Our Feed!

Leave a Reply

Your email address will not be published. Required fields are marked *