How To Change Linux Server Hostname { Ubuntu/Debian}

Last updated on August 19th, 2021 at 01:44 am.

If you are using Contabo VPS or any other cloud provider, you may need to change your Hostname. Here is a quick guide for how to change server Hostname.

What is the current hostname?

Check the current hostname:


Change the hostname –

To change the Ubuntu/Debian server hostname edit /etc/hostname .

sudo nano /etc/hostname

Delete the old name and add the new one. Then CTRL x, then Y and enter to exit out of the Nano editor.

Edit the hosts file – /etc/hosts .

sudo nano /etc/hosts

Change the old name to the new one in the hosts file.

Restart the server :

shutdown -r



Check host name again .


Related : Setup Linux Server VPS using Git Bash on Windows – Debian 10

~ Hostname man page on Debian.

Recommended VPS Providers

Find out the VPS providers I recommend.

Sign up below to download a Free Getresponse PDF Tutorial.

Comment Here

We use cookies on Continuing to use this website, implies consent of our Privacy Policy Privacy Policy

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.