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 localhost.localdomain
2. Modify “/etc/sysconfig/network” to change hostname :
[[email protected] ~]# vi /etc/sysconfig/network
NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=localhost.localdomain
Change the hostname to the following :
NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=centos58.ehowtuff.local
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. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 127.0.0.1 centos58.ehowstuff.local centos58
4. Reboot the server.
[[email protected] ~]# reboot
Like this Article? Subscribe to Our Feed!
This article was posted on Monday, April 23, 2012 at 9:53 PM