标签归档:aliyun

aliyun 主机修改hostname

1. modify /etc/hosts
[root@AY14032111447fdZ ~]# more /etc/hosts
127.0.0.1 localhost
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
#10.162.90.107 AY14032111447fdZ
10.162.90.107 w1.newhost.com

2.修改/etc/sysconfig/network的hostname一行。
[root@AY14032111447fdZ ~]# vi /etc/sysconfig/network
[root@AY14032111447fdZ ~]# more /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=w1.newhost.com
GATEWAY=218.244.142.242

3. 运行hostname命令
[root@AY14032111447fdZ ~]# hostname w1.newhost.com

4.重新登陆,已经改过来了
[louis@w1 ~]$ hostname
w1.newhost.com
[louis@w1 ~]$ hostname -s
w1