How To Change Linux Server Hostname { Ubuntu/Debian}

Last updated on July 27th, 2022 at 06:13 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.

Related : Ubuntu 22.04 Initial setup on a VPS

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.

Comment Here

Need WordPress help? Linux Server help? Talk to us.

  • We are your own WordPress customer service.
  • We set up Linux servers and install or migrate WordPress. Learn more here.
  • We support WooCommerce too.
  • Check out our WordPress customer support plans here or contact us below .

If you have any questions regarding WordPress support, Linux server support or any of our services, feel free to reach out or read more on our services page.

Join this free course:

How to host multiple WordPress
websites on a VPS

Close me!