Sharing Knowledge | System Admin Articles

Changing hostname without rebooting Linux server



Here the steps for changing the hostname in Linux (Redhat / CentOS / Fedora) without rebooting the server
For Suse Linux Enterprise Server Please refer this Article

First you need to find out your current hostname:


# hostname
server1.mydomain.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 ftpsrv.mydomain.com ftpsrv



Edit
/etc/sysconfig/network

To change servers hostname to ftpsrv.mydomain.com, change the file as follows.


# cat /etc/sysconfig/network


NETWORKING=yes
HOSTNAME=ftpsrv.mydomain.com

Now Type the following command in Terminal, 


# hostname ftpsrv.mydomain.com


#service syslog restart

Now, You should logout and login back to see the cahnges


Labels: Linux, Quick HOWTO

My Profile PhotoAbout the Author

I'm Parthiban, An UNIX System Admin by Profession. I'm Experienced in Linux/Unix System Administration and Scripting. I have done lot of work on the infrastructure Mgmt side in Linux, UNIX and Windows system administration, Hardware, Storage and Data center. I'm blogging since 2008.
Follow Me On Twitter or On Facebook

0 Comments for "Changing hostname without rebooting Linux server"

What do you think about this Article? Add your Opinion..!

Back To Top