How to set/change FQDN on Ubuntu 20.04 Linux

To set or change the Fully Qualified Domain Name (FQDN) on Ubuntu 20.04, you can follow these steps:

  1. Open the terminal by pressing “Ctrl + Alt + T” or by searching for “terminal” in the start menu.
  2. Run the command “sudo nano /etc/hostname” to open the hostname configuration file in nano text editor.
  3. Change the current hostname to the desired FQDN (e.g., “example.com”).
  4. Save the file by pressing “Ctrl + X”, then “Y”, and then “Enter”
  5. Run the command “sudo nano /etc/hosts” to open the hosts configuration file in nano text editor.
  6. Add or update the line “127.0.0.1 localhost.localdomain localhost [your FQDN]”
  7. Save the file by pressing “Ctrl + X”, then “Y”, and then “Enter”
  8. Run the command “hostnamectl set-hostname [your FQDN]” to set the hostname for the system.
  9. Run the command “hostname” to check the current hostname, it should display your new FQDN
  10. Run the command “reboot” to reboot the system for the changes to take effect.

Please note that the FQDN should match the DNS configuration for the domain, otherwise, you will have issues with name resolution. It’s also important to have a correct DNS configuration, if not the FQDN change may not work as expected.

You can also use other text editors such as “vi” or “gedit” instead of “nano” to edit the configuration files.

It’s important to note that the FQDN is used to identify your server on the network and should be unique. Changing the FQDN could break existing connections and configurations, so it’s essential to test it before applying the changes to the production environment.

Leave a Comment