Wednesday, March 17, 2010

[Level 1] Change Hostname in CentOS.

How to change hostname in CentOS.
1. Changing online server hostname.
Use command "hostname".
ex.
  # hostname my_new_hostname.my_new_domainname;

2. Changing hostname permanently.
  a. change setting "HOSTNAME" of file /etc/sysconfig/network
ex.
  HOSTNAME=my_new_hostname.my_new_domainname

  b. use command "sysctl"
ex.
  # sysctl kernel.hostname=\
my_new_hostname.my_new_domainname;


Wish this helps.

regards,
Stanley Huang