Changing Hostname and Fully Qualified Domain Name (FQDN) on Ubuntu 16.04

Im Durchschnitt wird dieses Tutorial Changing Hostname and Fully Qualified Domain Name (FQDN) on Ubuntu 16.04 mit 5 bewertet, wobei 1.0 die schlechteste und 5.0 die beste Bewertung ist. Es haben insgesamt 40229 Besucher eine Bewertung abgegeben.
40078 151

Changing Hostname and Fully Qualified Domain Name (FQDN) on Ubuntu 16.04

Hostname Ubuntu
Changing Hostname and Fully Qualified Domain Name (FQDN) on Ubuntu

Set your hostname and Fully Qualified Domain Name

A hostname is the name of a computer/cloud server that is connected to a network. The hostname is used to identify the computer in the network. It is also part of the Fully Qualified Domain Name (FQDN), which is required for many applications. If you intend to set an FQDN during the installation of Plesk, for example, this article can help.
The prerequisite is that the server has a root user. In this tutorial you will see how the hostname of the server and the FQDN can be set. In this example, we will use the name “web1.gridscale.io”.

Step 1: Set the hostname

To check which hostname is currently set, enter the following command into the console:

hostname

The output now shows:

test1

In this case, this is the hostname, which was set during setup in the gridscale panel. This can now be changed to any other name – in this example, web1.

Open the “/etc/hostname” file with an editor of your choice:

sudo nano /etc/hostname

replace your current hostname with a new hostname of your choice, we will replace ours with “web1”.  Save your changes with “Ctrl + O”, after confirming the filename with “Enter”, close nano with “Ctrl + X”. The change will take effect after the next restart – should you want the changes to take place without restarting, the following command will achieve that:

sudo hostname web1

Attention: Changing the hostname with the command “sudo hostname web1” is only temporary and will be overwritten when rebooted. To make the change permanent, it is necessary to edit the /etc/hostname file. This is not a replacement for the first step.
Check the command was successful by typing:

hostname

If it returns the new hostname you entered, the hostname was successfully set.

Step 2: Set the Fully Qualified Domain Name (FQDN)

In order to set the FQDN, the public IP of the server is required, in addition to your own FQDN. In this case, 123.123.123.123 is selected as an example.
The FQDN is modified in the /etc/hosts file.
Open the file in any editor with root privileges:

sudo nano /etc/hosts

The file should look something like this:

Ubuntu hosts

Now the following lines will be set:

123.123.123.123	web1.gridscale.io web1

When finished, it should look like this:

Ubuntu hosts with changes

Be sure to save the changes before the FQDN is verified with this command:

hostname –f

The FQDN has now been set successfully and these changes are permanent.

Set your hostname and Fully Qualified Domain Name A hostname is the name of a computer/cloud server that is connected to a network. The hostname is used to identify the computer in the network. It is also part of the Fully Qualified Domain Name (FQDN), which is required for many applications. If you intend to […]

Schade, dass dir der Artikel nicht gefallen hat.
Was sollten wir deiner Meinung nach besser machen?

Thank you for your feedback!
We will get back to you as soon as the article is finished.

Übrigens: kennst du schon unser Tutorial zum Thema Install Froxlor on Ubuntu?

×

Developer?

Get the latest gridscale developer tutorials here.
And don’t worry - we won’t spam you