cancel
Showing results for 
Search instead for 
Did you mean: 

hostname

SOLVED
Go to solution
Tarek_1
Frequent Advisor

hostname

Hi,
i know it's a stupid thing, but i'm not able to change the hostname on my Redhat 7.2. It's localhost now. I tried with hostname command, it changes it but after reboot restore's the old one. I had also modified the /etc/hosts and also /etc/hostname. It seems so difficult to change the hostname.
5 REPLIES
Daimian Woznick
Trusted Contributor

Re: hostname

I found this entry on a different mailing list:

+++++++++++++++++++++++++++++++++++++++++++++

> If the point is to keep the machine running (ideal), then two files should
> be modified. /etc/HOSTNAME again can be easily modified using the command
> "hostname host.domain.tld".

I recently did this, and also had to change:
/proc/sys/kernel/hostname, via sysctl. I also restarted daemons, just
in case (postfix, apache, etc). But still had the problem with X as
the OP.

--
Hal Burgiss

+++++++++++++++++++++++++++++++++++++++++++++


Hope this helps
Tarek_1
Frequent Advisor

Re: hostname

I appreciate your help Daimian but unfortunately it doesn't work! I also rebooted the ws, but without result.
On other unix systems (hpux,solaris..) it's so simple to change a hostname. On redhat there's something strange. The /etc/HOSTNAME does not exist, i don't know where redhat stores the hostname. I've seen the hostname man and it says to change that file, but it seems that at boot it isn't read!
K.C. Chan
Trusted Contributor
Solution

Re: hostname

Tarek, just go to /etc/sysconfig and vi network, there should be an entry for HOSTNAME=blabla, change that to whatever you want. You don't have to reboot, type "hostname " or just reboot. This should work.
Reputation of a thousand years can be determined by the conduct of an hour
Craig Kelley
Valued Contributor

Re: hostname

The hostname is set in /etc/sysconfig/network by anaconda. You can manually change it there, if you like.
Steven Mertens
Trusted Contributor

Re: hostname

hi,

You must modify the following config file :

/etc/sysconfig/network

NETWORKING=yes
HOSTNAME=yourhostname


then do a restart of your network

service network restart or do a reboot


regards

Steven