change hostname on rhel5
#vi /etc/sysconfig/network
hostname:
save and exit
# vi /etc/hosts
edit
save and exit
#service network restart
#service xinetd restart
___________________________________________
++++++++++++++++++++++++++++++++++++++++
========================================
Change hostname in Linux
First you need to find out your hostname, you can do this with
$ hostname
localhost.localdomain
$
Edit /etc/hosts
You need to edit /etc/hosts and add a line for your host name
$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
$
My new server IP is 72.232.196.90, i need to assign it hostname server12.hosthat.com, to do this, i have edited /etc/hosts as follows.
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
72.232.196.90 server12.hosthat.com server12
Edit /etc/sysconfig/network
First lets see what is in the file
$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
$
To change servers hostname to server12.hosthat.com, change the file as follows.
$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server12.hosthat.com
$
Now you need to reboot the server to change the hostname.