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
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. 






No comments:

Post a Comment