I can't seem to change the hostname on my CentOS 6.5 host. I am following instructions I found on this (now defunct) page.
I set my /etc/hosts
like so ...
[root@mig-dev-006 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain
192.168.32.128 ost-dev-00.domain.example ost-dev-00
192.168.32.129 ost-dev-01.domain.example ost-dev-01
... then I make my /etc/sysconfig/network
file like so ...
[root@mig-dev-006 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=ost-dev-00.domain.example
NTPSERVERARGS=iburst
... then I run hostname
like so ...
[root@mig-dev-006 ~]# hostname ost-dev-00.domain.example
... and then I run bash and all seems well ...
[root@mig-dev-006 ~]# bash
... but when I restart my network the old hostname comes back:
[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
file?/etc/hostname
file.[root@smp-mig-dev-006 ~]# ls -l /etc/hostname
outputsls: cannot access /etc/hostname: No such file or directory
hostname somename
, that it has a lasting effect? (if not why do you make that call?)/etc/hostname
is in CentOS 7 but not in CentOS 6.