How to set/change FQDN on Ubuntu 20.04 Linux

How to set/change FQDN on Ubuntu 20.04 Linux

To set or change the fully qualified domain name (FQDN) on Ubuntu 20.04, follow these steps:

  1. Edit the /etc/hostname file and set the hostname to the desired FQDN. For example:
refer t‮tual:o‬turi.com
sudo nano /etc/hostname
server1.example.com
  1. Edit the /etc/hosts file and set the FQDN as the first entry for the localhost address (127.0.0.1). For example:
sudo nano /etc/hosts
127.0.0.1   server1.example.com server1 localhost
  1. Save and close the file.

  2. Reboot the system to apply the changes:

sudo reboot

After the system has restarted, the FQDN should be set to the new value. You can use the hostname command to verify the current FQDN:

hostname -f

This will display the FQDN of the system.

Created Time:2017-10-29 22:08:38  Author:lautturi