CentOS5のホスト名(FQDN)を変更する

CentOSのホスト名(FQDN)を変更する

# vi /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost

1 localhost6.localdomain6 localhost6

xxx.xxx.xxx.xxx myhostname.com myhostname

# vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=myhostname.com
GATEWAY=xxx.xxx.xxx.xxx

※(注意)GATWAYを変えると外部から接続できなくなる可能性あり


myhostnameの部分をfix.myhostnameに変更して完了

最後に再起動を忘れずに

# /etc/rc.d/init.d/network restart

Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]

OS再起動
# reboot

確認
# hostname

fix.myhostname.com

OK!