9 September 2014

Change a Linux hostname boot persistent

Q: How to change your linux box hostname after you have installed your OS:

A: You can change your hostname temporarily by hostname command.

Getting current hostname:
# hostname

Change it to desired name:
# hostname test2

# hostname

But if it is not boot persistant and after reboot it goes back to previous hostname. To make it boot persistent we need to change it in the network config file: 

# vi /etc/sysconfig/network


And after reboot we have the new hostname permanently. 

No comments:

Post a Comment