我似乎无法更改CentOS 6.5主机上的主机名。我正在按照在这里找到的说明进行操作:http : //www.rackspace.com/knowledge_center/article/centos-hostname-change
我让我/etc/hosts
喜欢...
[root@mig-dev-006 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain
192.168.32.128 ost-dev-00.domain.com ost-dev-00
192.168.32.129 ost-dev-01.domain.com ost-dev-01
...然后我/etc/sysconfig/network
像这样制作我的文件...
[root@mig-dev-006 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=ost-dev-00.domain.com
NTPSERVERARGS=iburst
...然后我hostname
像这样奔跑...
[root@mig-dev-006 ~]# hostname ost-dev-00.domain.com
...然后我运行bash,一切似乎都很好...
[root@mig-dev-006 ~]# bash
...但是当我重新启动网络时,旧的主机名又回来了:
[root@ost-dev-00 ~]# /etc/init.d/network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/6
state: activated
Connection activated
[ OK ]
[root@ost-dev-00 ~]# bash
[root@mig-dev-006 ~]#
...我不知道。我在这里做错了。
/etc/hostname
文件。[root@smp-mig-dev-006 ~]# ls -l /etc/hostname
输出ls: cannot access /etc/hostname: No such file or directory
hostname somename
,它具有持久的作用吗?(如果不是,那么为什么
/etc/hostname
是CentOS的7,但不是在CentOS的6
/etc/hostname
文件了吗?