Permanently change the hostname
Hi , i want to permanently change my machine's name as linuxQube or something like that.. the hostname command onyl sets it for the current session ..when i reebot i get localhost.localdomain. I run apache, tomcat etc etc.. will chnaging m hostname affect those services ?? how can i do it "safe" :) ???
|
Hi,
Edit ur /etc/hosts file to add the hostname. Or you can use linuxconf or netconf to give the hostname. Hope this helps. Senthil |
this thread helped me
http://www.linuxquestions.org/questi...threadid=57490 |
Quote:
cheers Jamie... |
Hello!
redhat=>system settings=>network enter root password click "hosts" tab and enter a name! |
Oops Sorry,
U have to set it in /etc/sysconfig/network file. Senthil |
i tried it in rc.sysinit but apache wwebserver dint start !
|
Create a file /etc/hostname
Put one entry in that file, your hostname. My file: Code:
tinwhistle Code:
# Gentoo Celeron 850 box tinwhistle /etc/hosts file |
I got so frustrated not being able to change the host name permanently, that I finally did a "slocate localhost" and then visited all the files that appeared to play a role in keeping my computer so stupidly named, and changed every instance (about four, as it turned out) to the name I wanted.
Result: name permanently changed. HOWEVER, I am not on a network, just a lone desktop with Internet access. So I would not advise this approach for anybody with a more complex setup. It could indeed be asking for trouble. EDITED: Oops, sorry, what I did was look for the string "localhost" inside all files, using Midnight Commander's search function. Slocate would not give that information. |
If u see /etc/rc.sysinit file, /etc/sysconfig/network file is sourced to set the hostname and then the value of /bin/hostname is read. So if you set the hostname in /etc/sysconfig/network you should be ok.
I think you should also set the ServerName in httpd.conf or think it reverts to localhost. Senthil |
Got it fine !! tahnx all
i changed the etc/hosts file
as 127.0.0.1 linuxcube.localdomain linuxcube & then the etc/sysconfig/network file's hostname = linuxcube everything works fine ..thanx for the help ! |
The command to set or change the system hostname is 'hostname'.
Do 'man hostname' to read the unix manual page for the hostname command. |
Quote:
|
Hi,
As I told before, you have to set it in /etc/sysconfig/network. Or a hack - do hostname -v <HOSTNAME> in /etc/rc.d/rc.local file. Instead of manually setting for that boot session this does it automatically. Cheers, Senthil |
All times are GMT -5. The time now is 10:17 PM. |