[root@base ~]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=nfs00.example.com
The configuration above makes sure that the new hostname (fqdn to be exact) will be persistent and will stick after a reboot.
[root@base ~]# hostname nfs00.example.com
[root@base ~]# uname -a
Linux nfs00.example.com 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:54 EDT 2009 i686 i686 i386 GNU/Linux
[root@base ~]# hostname
nfs00.example.com
[root@base ~]#
Notice that the output of the uname -a command or hostname already shows the intended hostname for this system. But on the shell, it still says its base. At this point we need to logout and login again in order for us to get the new hostname.
Connection to 192.168.56.101 closed.
motto:~ motto$ ssh root@192.168.56.101
root@192.168.56.101's password:
Last login: Fri Apr 9 14:32:27 2010 from 192.168.56.1
[root@nfs00 ~]#
Voila! Our servers hostname is now nfs00.
No comments:
Post a Comment