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
example.domain.com

Change it to desired name:
# hostname test2

# hostname
test2

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

NETWORKING=yes
HOSTNAME=test2


And after reboot we have the new hostname permanently. 






Comments

Popular posts from this blog

Rebuild your new Yum repository after changing the packages

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

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