Thursday, August 30, 2012

How to Change the Hostname on Linux CentOS 6.3 Server




In this post, i will show you on how to change the Hostname on linux CentOS 6.3. I have tested this on RHEL 6, CentOS 5.5 and CentOS 6.2.  and Centos 6.3. Reboot is required for both options (A) and (B) for the changes to take effect.

Check current hostname with this command :
# hostname --fqd
centos62.ehowstuff.local
Option A:
1. Modify /etc/sysconfig/network
# vi /etc/sysconfig/network
2. Edit to your preferred hostname :
NETWORKING=yes
 
HOSTNAME=server.vjetnamnet.local
3. Modify /etc/hosts file as below :
# vi /etc/hosts
 
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
 
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
 
192.168.1.44 server.vjetnamnet.local server
4. Save and reboot your server.
Option B:
1. Type the following command to enter GUI mode.
# system-config-network
2. Go to “DNS Configuration”.
3. Modify your preferred hostname and click OK.
4. Click ” Save & Quit”.
5. Modify /etc/hosts file as below :
# vi /etc/hosts
 
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
 
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
 
192.168.1.44 server.vjetnamne.local server
6.Reboot your server.

No comments:

Post a Comment

I would be glad to know if this post helped you.