How to change the hostname CentOS

Written by ehowstuff. Posted in Lost and found

http://vjetnamnet.com/how-to-change-the-hostname-on-linux-centos-6-3-server/

Check current hostname with this command :

# hostname --fqd

centos62.ehowstuff.local

1. Modify /etc/sysconfig/network

# nano /etc/sysconfig/network

2. Edit to your preferred hostname :

NETWORKING=yes
HOSTNAME=server.vjetnamnet.local

3. Modify /etc/hosts file as below :

# nano /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.

Add comment


Security code
Refresh