Here the steps for changing the hostname in Linux without rebooting the server.
First you need to find out your current hostname:
# hostname
server1.kkdomain.com
Now, Edit /etc/hosts
For example, I need to assign it hostname as ftpsrv.mydomain.com.
To do this, I have edited /etc/hosts as follows.# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.2.100 host.kkdomain.com host
Edit /etc/sysconfig/network
To change servers hostname to host.kkdomain.com, change the file as follows.
# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=host.kkdomain.com
Now Type the following command in Terminal,
# hostname host.kkdomain.com
#service syslog restart
Now, You should logout and login back to see the changes
First you need to find out your current hostname:
# hostname
server1.kkdomain.com
Now, Edit /etc/hosts
For example, I need to assign it hostname as ftpsrv.mydomain.com.
To do this, I have edited /etc/hosts as follows.# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.2.100 host.kkdomain.com host
Edit /etc/sysconfig/network
To change servers hostname to host.kkdomain.com, change the file as follows.
# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=host.kkdomain.com
Now Type the following command in Terminal,
# hostname host.kkdomain.com
#service syslog restart
Now, You should logout and login back to see the changes
No comments:
Post a Comment
Thank You:)