How To Change Your Hostname on Debian

To change your hostname into Debian based Linux server, Follow the steps below.

Step 1: Login to your VPS

Locate the IP address of your VPS and login as the root user using a SSH client like putty.
Step 2: Edit /etc/hostname file

Open the /etc/hostname file with your favorite text editor. For example:

nano /etc/hostname

Update your hostname in this file. Then save the file, and exit the text editor.

Step 3: Edit /etc/hosts

Open the /etc/hosts file with your favorite text editor. For example:

nano /etc/hosts

Change the first line and replace your old hostname with the new one. Save the file and exit the editor.

Step 4: Run hostname.sh

Run the following command to update your hostname:

/etc/init.d/hostname.sh start

Step 5: Check your hostname

Run the following command to check your new hostname:

hostname

The new hostname will be appeared into your ssh terminal.

That’s all we have to do, Previously we have discuss about how to set hostname into  CentOS please check that and also give your opinion below if you experience any issues or to discuss your ideas and experiences.