Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-07-2010, 11:22 AM
|
#1
|
Member
Registered: Feb 2008
Posts: 112
Rep:
|
uname -n node name change
Hello;
I want to change my servers node name which is the output of "#uname -n"
Server is CentOS 5
I searched but couldn't find. There was some search results about /etc/nodename but I don't have a file at that path. Also some said uname -S which doesn't work...
How can I change it?
|
|
|
02-07-2010, 11:55 AM
|
#2
|
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Fedora40
Posts: 6,153
|
uname -n just prints your hostname which is stored in /etc/hostname
See man hostname
|
|
|
02-07-2010, 12:52 PM
|
#3
|
Member
Registered: Feb 2008
Posts: 112
Original Poster
Rep:
|
No it doesn't print what's in the hostname.
I'm using a vps, could it be the reason of that?
|
|
|
02-07-2010, 01:18 PM
|
#4
|
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Fedora40
Posts: 6,153
|
Possibly, but if you had mentioned "vps", I would not have replied.
What is a "vps" ?
|
|
|
02-07-2010, 01:31 PM
|
#5
|
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290
|
A VPS is a Virtual Private Server, i.e. a server running in a virtual machine.
The usual way I change the hostname in CentOS 5 is to edit it in /etc/sysconfig/network. I generally find that it takes a reboot to make all programs "see" the new hostname.
|
|
|
02-07-2010, 01:50 PM
|
#6
|
Member
Registered: Feb 2008
Posts: 112
Original Poster
Rep:
|
Vps: http://en.wikipedia.org/wiki/Virtual_private_server
@btmiller
Yes It's probably changed in that file but after I reboot it always changed to its original value. So yes problem is because of vps.
Thanks guys
|
|
|
02-07-2010, 02:25 PM
|
#7
|
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290
|
Do you get your IP via DHCP. I believe DHCP can get its host name from the DHCP server ... maybe this is what's happening to you?
|
|
|
02-07-2010, 02:26 PM
|
#8
|
Member
Registered: Feb 2008
Posts: 112
Original Poster
Rep:
|
nope. ip is static
|
|
|
06-06-2011, 07:23 PM
|
#9
|
LQ Newbie
Registered: Jun 2011
Posts: 1
Rep: 
|
Some background before I get into the node name update process that worked for me. I'm configuring a bunch of load balanced blades on CentOS 5.4 with non-ARPing loopback configured by adding an entry to the rc.local file and to get "ifconfig" reading that, I wasn't rebooting, but just running "/etc/rc.d/rc.local".
Anyway, I too was frustrated by "uname -n" not being settable. I had some blades that reported different values, including the IP in their node name. That's what I wanted. I even tried strace -o, but all that told me was that uname was getting called! But I also had a bunch that didn't, instead just reporting "localhost.localdomain" as their nodename, so I knew there was something different in the process, and nothing config file related as I followed the same setup for all. Like you, nothing worked to set it...until I executed a reboot, at which point nodename updated to the desired change.
So, the setting is there somewhere in the init chain, not sure where yet, but you can try a reboot and hopefully that'll do it for you too.
|
|
|
All times are GMT -5. The time now is 08:54 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|