LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 02-07-2010, 10:22 AM   #1
Seregwethrin
Member
 
Registered: Feb 2008
Posts: 112

Rep: Reputation: 16
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?
 
Old 02-07-2010, 10:55 AM   #2
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
uname -n just prints your hostname which is stored in /etc/hostname

See man hostname
 
Old 02-07-2010, 11:52 AM   #3
Seregwethrin
Member
 
Registered: Feb 2008
Posts: 112

Original Poster
Rep: Reputation: 16
No it doesn't print what's in the hostname.

I'm using a vps, could it be the reason of that?
 
Old 02-07-2010, 12:18 PM   #4
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Possibly, but if you had mentioned "vps", I would not have replied.
What is a "vps" ?
 
Old 02-07-2010, 12:31 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,062

Rep: Reputation: 295Reputation: 295Reputation: 295
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.
 
Old 02-07-2010, 12:50 PM   #6
Seregwethrin
Member
 
Registered: Feb 2008
Posts: 112

Original Poster
Rep: Reputation: 16
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
 
Old 02-07-2010, 01:25 PM   #7
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,062

Rep: Reputation: 295Reputation: 295Reputation: 295
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?
 
Old 02-07-2010, 01:26 PM   #8
Seregwethrin
Member
 
Registered: Feb 2008
Posts: 112

Original Poster
Rep: Reputation: 16
nope. ip is static
 
Old 06-06-2011, 06:23 PM   #9
amiller
LQ Newbie
 
Registered: Jun 2011
Posts: 1

Rep: Reputation: Disabled
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.
 
  


Reply

Tags
name, node, uname


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to make a DRBD node start itself as a primary node automatically? pyruby Linux - Newbie 1 01-29-2010 12:41 PM
mysqld node of mysql cluster system not connecting to management node coal-fire-ice Linux - Server 0 05-07-2008 11:39 AM
change output of `uname -a` introuble Linux - General 7 08-03-2006 05:15 AM
how to change Unix name (uname -o)? mieslep Programming 9 05-23-2004 12:47 PM
VMWare problems: can't change device node... shiny_spoon Linux - Software 2 11-19-2003 09:33 PM


All times are GMT -5. The time now is 12:50 PM.

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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration