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:

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

or

reboot


Check host name again .

 hostname 

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.

Cheapest dedicated Server provider. View prices.
The most reliable VPS cloud provider - Vultr Cloud

Comment Here