Tuesday, October 30, 2012

Linux: CentOS 6.3 - Changing the hostname or computer name

First of all, you need the command to check what is your box computer name(hostname).

Please note that all the "#" sign shown are meant to be the start of the command prompt, therefore please ignore it.

To check your hostname, type the following command:
# hostname

I am using the following method to change the hostname of my linux box:-

1. Change the hostname by using sudo hostname command.
# sudo hostname 'newhostname'
(without the quotes)

2. Edit the network configuration file. Type this command to use vi editor.
vi /etc/sysconfig/network
2.2 Find the following line => hostname = localhost.domain.local
change the "localhost.domain.local" to your new hostname.
(note: in vi editor press i or the insert key to switch to insert/editing mode. Press "Esc" to exit insert/editing mode.)
2.3 Save and close the file.
(note: in vi editor type :wq! follow by enter to save and quit the editor)


No comments:

Post a Comment