New on : Change Linux Hostname
How do you change Linux hostname? Not one intuitive answer comes to mind. But, it’s easier to do than changing Windows hostname. There are two options for you to change Linux hostname.
- Edit the /etc/sysconfig/network file on Red Hat distros, or /etc/hostname on Debian distros.
- Change the kernel.hostname variable.
1. You need to edit a file called “network” in folder /etc/sysconfig/. Fire up your favorite text editor:
vi /etc/sysconfig/network
Position yourself at the line that starts with “HOSTNAME=”, press “i” to start writing and change your hostname. Press Esc key to get back to vi’s command mode, type “:w” for saving the file and then “:q” for quitting the editor.
2. Run the following command:
sysctl kernel.hostname=NEW_HOSTNAME
Change NEW_HOSTNAME to your desired hostname.
More: Change Linux Hostname