LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Thread Tools
Old 10-16-2008, 05:10 AM   #1
yusufs
Member
 
Registered: Oct 2007
Posts: 162
Thanked: 0
Changing hostname


[Log in to get rid of this advertisement]
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
yusufs is offline     Reply With Quote
Old 10-16-2008, 05:31 AM   #2
bhajan.verma
LQ Newbie
 
Registered: Jul 2006
Posts: 14
Thanked: 0
you can change hostname in file /etc/sysconfig/network also in /etc/hosts

then reboot the system.
bhajan.verma is offline     Reply With Quote
Old 10-16-2008, 05:32 AM   #3
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly
Posts: 173
Thanked: 1
Hi yusufs

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

Angel.

Last edited by angel115; 10-16-2008 at 05:45 AM..
angel115 is offline     Reply With Quote
Old 10-16-2008, 05:47 AM   #4
yusufs
Member
 
Registered: Oct 2007
Posts: 162
Thanked: 0

Original Poster
Quote:
Originally Posted by angel115 View Post
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
yusufs is offline     Reply With Quote
Old 10-16-2008, 06:08 AM   #5
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Thanked: 126
You will need to change /etc/sysconfig/network in redhat. Don't forget to restart the network services once changed
billymayday is offline     Reply With Quote
Old 10-16-2008, 08:26 AM   #6
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: Debian Lenny / Squeeze / Sid
Posts: 7,213
Blog Entries: 5
Thanked: 246
I usually run through this guide to make sure everything is set properly and returns the correct hostname.

http://www.cpqlinux.com/hostname.html
farslayer is offline     Reply With Quote
Old 10-16-2008, 08:33 AM   #7
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly
Posts: 173
Thanked: 1
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.
angel115 is offline     Reply With Quote
Old 10-16-2008, 03:22 PM   #8
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Thanked: 126
I use 5, so may be different.

Do you havea utility called "system-config-network" installed?
billymayday is offline     Reply With Quote
Old 10-16-2008, 11:21 PM   #9
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: Debian Lenny / Squeeze / Sid
Posts: 7,213
Blog Entries: 5
Thanked: 246
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
farslayer is offline     Reply With Quote
Old 10-17-2008, 12:27 AM   #10
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Thanked: 126
Actually using the hostname command would probably achieve the same.
billymayday is offline     Reply With Quote
Old 10-17-2008, 01:56 AM   #11
bhajan.verma
LQ Newbie
 
Registered: Jul 2006
Posts: 14
Thanked: 0
to chnage host name without reboot u can use echo "hostname" > /proc/sys/kernel/hostname.

hostname command only work for current open shell.
bhajan.verma is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing hostname arnuld Fedora 8 12-13-2007 06:28 AM
hostname changing rusty_slacker Linux - General 2 04-15-2005 07:49 PM
Changing hostname? Alf829 Linux - Networking 2 03-08-2004 09:31 AM
Changing the hostname. KrazyKid Slackware 6 06-30-2002 10:56 PM
changing hostname glock19 Linux - Networking 3 02-01-2002 10:26 PM


All times are GMT -5. The time now is 07:24 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration