1753473 Members
4672 Online
108794 Solutions
New Discussion юеВ

Re: change hostname

 
Tonatiuh
Super Advisor

change hostname

Red Hat Enterprise Linux 4.8

How can I change the hostname of the server once it has been installed?
6 REPLIES 6
Gokul Chandola
Trusted Contributor

Re: change hostname

Hi,
Go to System Administration, there are option to change Hostname etc.

Regards,
Gokul Chandola
There is always some scope for improvment.
JKytsi
Honored Contributor

Re: change hostname

RedHat based system use the file /etc/sysconfig/network to read the saved hostname at system boot. This is set using the init script /etc/rc.d/rc.sysinit

/etc/sysconfig/network NETWORKING=yes HOSTNAME="plain.domainname.com" GATEWAY="192.168.0.1" GATEWAYDEV="eth0" FORWARD_IPV4="yes"So in order to preserve your change on system reboot edit this file and enter the appropriate name using the HOSTNAME variable.

Remember to give Kudos to answers! (click the KUDOS star)

You can find me from Twitter @JKytsi
Matti_Kurkela
Honored Contributor

Re: change hostname

If you change the hostname by editing /etc/sysconfig/network, also remember to edit /etc/hosts.

The system must be able to resolve its own name using /etc/hosts when it's starting up and the network interfaces have not been activated yet.

MK
MK
Yogesh M Puranik
Valued Contributor

Re: change hostname

Hi,

After Changing the above mentioned files,dont forget to restart the netwok/reboot the server.

#service network restart

Rgds
Yogesh

Hakki Aydin Ucar
Honored Contributor

Re: change hostname

Edit network at address:

vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=your_host_name
Wilfred Chau_1
Respected Contributor

Re: change hostname

temporary:
as root:
echo "newhostname" > /proc/sys/kernel/hostname

permanent:
as root:
system-config-network
under dns, change to your new hostname
then save your changes