Oracle Linux - renaming your hostname

 

Here is a quick note on the procedure for renaming the hostname of a server running with Oracle Linux. In this example, I cloned my Virtualbox VM (kirlinc.home) to a new VM with hostname as kirlinb.home
 
Clone Virtual Machine
 
==> Use the virtualbox Clone option to Clone an existing VM(kirlinc) to a new VM (kirlinb)
      Provide the new Network Configuration for the copied VM
      Make sure you reinitialize the mac address, so the new VM gets the new address
 
 
 
 
Startup the new VM & make Necessary Changes for the rename
 
==> Check the network Configuration and if DHCP is not used, make sure it has the static ipaddress you needed 
     Update the /etc/sysconfig/network file with the new hostname
     Make chnges to /etc/hosts if needed.. (here, the hostname/ipaddress is already defined in my router DNS configuration, hence no changes are needed)
     
 
[root@kirlinc ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=kirlinc.home

[root@kirlinc kiran]# vi /etc/sysconfig/network
[root@kirlinc kiran]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=kirlinb.home

[root@kirlinc ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1     	localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@kirlinc kiran]# service network restart
Shutting down loopback interface:                      	[  OK  ]
Bringing up loopback interface:                        	[  OK  ]
Bringing up interface Auto_eth2:  Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2
                                                       	[  OK  ]

 

 
Verify the Changes
 
==> My cloned VM has the new hostname as defined and the new host is reachable from other servers in the network
 
[root@kirlinb kiran]# ping kirlinb
PING kirlinb.home (192.168.1.52) 56(84) bytes of data.
64 bytes from kirlinb.home (192.168.1.52): icmp_seq=1 ttl=64 time=0.035 ms
64 bytes from kirlinb.home (192.168.1.52): icmp_seq=2 ttl=64 time=0.096 ms
64 bytes from kirlinb.home (192.168.1.52): icmp_seq=3 ttl=64 time=0.064 ms
64 bytes from kirlinb.home (192.168.1.52): icmp_seq=4 ttl=64 time=0.094 ms



[kiran@kirlinc ~]$ ssh kirlinb
The authenticity of host 'kirlinb (192.168.1.52)' can't be established.
RSA key fingerprint is 85:ea:94:bc:4d:7e:03:6c:b7:cf:c9:51:14:a4:45:b7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'kirlinb,192.168.1.52' (RSA) to the list of known hosts.
Last login: Wed Mar 12 18:41:00 2014 from localhost
[kiran@kirlinb ~]$

 

 
Hope this helps!

 

 
Cheers!

 

rajkiran

 

 
 
 

Copyright ©2018 Rajkiran Ghanta (deegeplanet.com)