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. 


Popular posts from this blog

Linux and AIX user non expiry and force password change at first login

Rebuild your new Yum repository after changing the packages

Running Docker Wildfly/JBoss Application Server in Debug mode via Eclipse