What is my VPS hostname, and how to change VPS Hostname?

Learn the simple step-by-step guide on how to change your VPS (Virtual Private Server) hostname effortlessly. Discover the importance of a custom hostname and follow our expert tips to successfully update it. Optimize your server configuration and enhance your online presence today!

Updated: 07 Aug, 23 by Susith Nonis 10 Min

List of content you will read in this article:

Do you want to know how to change VPS hostname? Firstly,  you should know that VPS hostname is the name of a device in a network. It can also be referred to as a computer name or site name. The hostname is used to distinguish devices within a local network. In addition, other people can find computers using the hostname, which allows data exchange within a network. On the Internet, hostnames are used within Fully Qualified Domain Names.

If you want to know more about using a VPS, check out our detailed article via the link.  

The hostname is the name of your truce on a network; for example, you will see it as the name of the server that sends emails. As for the VPS, it's what you would name your server. The VPS hostname example will be displayed in the VPS section. A good hostname will help you easily identify the server you want to manage. In the following, we will get to how to change the VPS hostname and change VPS IP.

The hostname is a freely selectable name for a computer. For example, you can name a corporate network server responsible for central email administration "mail" or "mail123".

However, if a computer is to be available locally and via the Internet, the hostname must be supplemented with additional information that forms a chain of names. These are called "Fully Qualified Domain Names". An example of an FQDN would be:

mail123.example.com.

Reading the terms from right to left respecting the hierarchy, the components of an FQDN are visible in the following order:

  • Root Label (empty)
  • top-level domain (.com)
  • second level domain (example)
  • hostname (mail123).

An FQDN is a human-readable form of address. Unlike us, computers use numerical IP addresses to identify computers on the Internet uniquely. When visiting a web page, an intermediate step is necessary in which the alphanumeric domain is translated into a numeric IP address.

The Domain Name System (DNS) is responsible for this name resolution. The domain entered is assigned to the corresponding IP address to find the page you are looking for. This system allows human users to use an easier-to-remember name rather than having to enter the IP address each time they go to a website.

The hostname can be anything, like a subdomain or a simple string like "MyServer". The main difference is whether the hostname is accessible or not on the Internet. For example, a hostname such as "MyServer" can only be found on your network, while an Internet hostname such as "myserver.domain.tld" is also accessible on the Internet.

The domain name, which you configure as a hostname, must be managed on your side: you must have full control over this domain name, including the possibility of modifying its DNS zone. 

We recommend that you specify your hostname as a domain or subdomain, for example, "myserver.domain.tld", where "domain.tld" is a domain hosted on this server.

The easiest way to find out the hostname of a computer to know how to change VPS hostname in Windows is to open the command prompt, type the code below, and then hit Enter:

 

To know how to Change a Windows VPS Password follow the link here.

You can also display the hostname if you use the following command in the command line:

ipconfig /all

You get the hostname in the line that has the name "Host Name".

Entering the following command will also get its hostname:

nbtstat -n

 That was the whole recipe for getting known how to change VPS hostname.

To change your computer name, you must quit the command line again. In Windows 10, click Windows + X and select "System". At the bottom right, go to the settings and click “Edit” in the opened window. Enter the desired name in the "Computer name" field and press "OK". The change takes effect as soon as you restart the computer.

It is also possible to select "All settings" in the notification area and click on "System". Under "System Information", you will find the option "Rename PC". Click it to open a window to change the computer's name.

To change the name in Windows 7, go to the start menu, right-click "Computer", and select the "System Properties" category. The penultimate section displays the computer name, which can be changed by clicking "Edit". Windows XP's computer name can also be changed under "Properties". To do this, right-click “My Computer” in the Start menu and select “Properties”.

To determine the hostname of a linux server, enter the following into the terminal as you would on Windows:

hostname

Even changing the name until the next restart is done with a simple input:

sudo hostname new_name

Instead of new_name, enter the desired hostname and confirm with your password if necessary to make the change.

How to change hostname linux! Curious? The command used in Linux to permanently change the name depends on the Linux distribution you are using. On Ubuntu and other Debian-based distributions, you will find the hostname in the following file:

/etc/hostname

 This can be edited in the editor. If you run the following script, you can accept the change directly:

/etc/init.d/hostname.sh

 In source-based distributions of RedHat, you can find the hostname in the following file, among others:

vi /etc/sysconfig/network

 

You change the hostname in this line:

HOSTNAME=new_name

 Enter the desired hostname instead of the new_name. By executing the script below, the modification will take effect directly.

/etc/rc.d/rc.sysinit

 That is the whole process in linux how to change hostname permanently! 

Changing the devise hostname has its challenge. Sometimes only the IP address of a computer in a network is available, and the hostname could help identify the computer faster. You can use the "nslookup" command to determine the name of a computer via its IP address

how to change hostname via PowerShell

To do this, type the following line in the command line:

nslookup %ipaddress%

Replace %ipaddress% with the computer's IP address you are looking for and then hit Enter. The device's server, address, name and IP address are displayed. The value displayed after "Name" is the host or Fully Qualified Domain Name.

🌈 Discover the freedom of VPS hosting – take control of your hosting environment and enjoy unparalleled reliability and blazing-fast speeds. 🚀💻🔥

The first thing we need to do is - get the current hostname. To display the current hostname, type the following command:

Hostnamectl

 

As you can see in the image above, the current hostname for this server is - wyldebuntu. The following steps, described below, shows how to change VPS hostname example in Ubuntu 18.04

 

Change the hostname using the hostnamectl command.

For example, to change the system's static hostname to serverspace, you would use the following command:

sudo hostnamectl set-hostname serverspace

The hostnamectl command does not produce output. If successful, 0 is returned; otherwise - a non-zero failure code.

Edit the /etc/hosts file.

Open the /etc/hosts file with your favourite text editor and replace the old hostname with the new one:

sudo nano /etc/hosts

Server space 127.0.0.1:

 

Press Ctrl + O, then Enter to save the modified file, then press ctrl + X to exit nano.

Edit the cloud.cfg file.

If the cloud-init package is installed, you must also modify the cloud.cfg file. This package is typically installed by default in images provided by cloud providers such as AWS and is used to manage the initialization of cloud instances.

To check if the package is installed, just run the following command:

ls -l /etc/cloud/cloud.cfg

 

If you see the following output, the package is not installed, and no further action is required.

ls: Cannot access '/etc/cloud/cloud.cfg': No such file or directory.

If the package is installed, the output will look like this:

-rw-r--r-- 1 root root 3169 May 21 17:35 /etc/cloud/cloud.cfg

In this case, you will need to open the /etc/cloud/cloud.cfg file:

sudo nano /etc/cloud/cloud.cfg

Find preserve_hostname and change the value from false to true.

Press Ctrl + O, then Enter to save the modified file, then press ctrl + X to exit nano. Then, check the change

To verify that the hostname has been changed, use the hostnamectl command again:

Hostnamectl

 

You should see your new server name printed in the output.

 

 Changing the hostname of your VPS (Virtual Private Server) is a straightforward process that can significantly impact your server's identity and online presence. By following the step-by-step guide outlined above, you can easily update your VPS hostname.

A custom hostname enhances your server's branding and aids in better server management and identification. It allows you to create a more personalized online experience for your users and clients.

Remember, before changing the hostname, ensure you have a backup of your important data and configuration settings to avoid unforeseen issues. Also, double-check the new hostname's compatibility with your applications and services to prevent disruptions.

Overall, taking the time to modify your VPS hostname is a small yet essential task that can significantly improve server administration and overall user experience. Embrace the power of a custom hostname and make your VPS stand out in the digital landscape. Happy hosting!

Susith Nonis

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I venture into the world of Technology, I try to share what I know in the simplest way with you. Not a fan of coffee, a travel addict, and a self-accredited 'master chef'.