Thursday, 18 February 2016

Changing Hostname on RHEL

It is possible to change the hostname without reboot; this is very helpful in Production environment.

Here I have change the hostname of the server without restarting on RHEL

Step 01: Change the HOSTNAME line in /etc/sysconfig/network

[root@aca800de root]# vi /etc/sysconfig/network
HOSTNAME=vasappserver1

Step 02: Change the hostname (FQDN and alias) in /etc/hosts

[root@aca800de root]# 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
172.168.0.222     vasappserver1.ring.com.bd     vasappserver1

Step 03: Run /bin/hostname new_hostname for the hostname change to take effect immediately.

[root@aca800de root]# /bin/hostname vasappserver1
[root@aca800de root]# hostname
vasappserver1

Step 04: Run /sbin/service syslog restart for syslog to log using the new hostname.

[root@aca800de root]# service syslog restart
Shutting down kernel logger:                               [  OK  ]
Shutting down system logger:                               [  OK  ]
Starting system logger:                                    [  OK  ]
Starting kernel logger:                                    [  OK  ]

No comments:

Post a Comment