LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Changing hostname (https://www.linuxquestions.org/questions/linux-newbie-8/changing-hostname-676731/)

yusufs 10-16-2008 04:10 AM

Changing hostname
 
Hai all,

We are using RHEL ES 4.0 Update 6

We have a network of 35 Linux servers, (with no domain installation)..Currently there is a requirement that one server name has to be changed as follows :

linux.nodomain.com to apps.domain.com..

Where do I have to change this ?.. How can I make sure that there are no traces of the old hostname remains in the server..Do I have to reboot the server ?

Please advise


Yusuf

bhajan.verma 10-16-2008 04:31 AM

you can change hostname in file /etc/sysconfig/network also in /etc/hosts

then reboot the system.

angel115 10-16-2008 04:32 AM

Hi yusufs

If you edit the /etc/hosts file should be enough

Angel.

yusufs 10-16-2008 04:47 AM

Quote:

Originally Posted by angel115 (Post 3311920)
Hi yusufs

If you edit the /etc/hosts file should be enough

Angel.



Thanks Friends,

Will do and let you know if there is any problem


Yusuf

billymayday 10-16-2008 05:08 AM

You will need to change /etc/sysconfig/network in redhat. Don't forget to restart the network services once changed

farslayer 10-16-2008 07:26 AM

I usually run through this guide to make sure everything is set properly and returns the correct hostname.

http://www.cpqlinux.com/hostname.html

angel115 10-16-2008 07:33 AM

Hi billymayday,

I've just done the test on Readhat 4
After editing the file /etc/sysconfig/network, and restarting the network service doesn't seems to be enough.

After a reboot the changes are done but it should be an other way to apply the change without restarting.

Here is what I've tried and doesn't work:
Code:

service network restart
service network reload
Ifconfig eth0 down && Ifconfig eth0 up
xinetd restart

The above have no effect and the hostname stay unchanged.

billymayday 10-16-2008 02:22 PM

I use 5, so may be different.

Do you havea utility called "system-config-network" installed?

farslayer 10-16-2008 10:21 PM

I believe this section of the link I posted previously would have made the switch without the reboot..

Quote:

Checking /proc/sys/kernel/hostname
This is checked with the following command:

cat /proc/sys/kernel/hostname

If you need to set this file, you can either reboot or set it now with the following command:

echo mybox.mydomain.com > /proc/sys/kernel/hostname
shouldn't skip over them provided links :)

billymayday 10-16-2008 11:27 PM

Actually using the hostname command would probably achieve the same.

bhajan.verma 10-17-2008 12:56 AM

to chnage host name without reboot u can use echo "hostname" > /proc/sys/kernel/hostname.

hostname command only work for current open shell.


All times are GMT -5. The time now is 09:14 AM.