Set a fully qualified domain name (FQDN) hostname on your server
No matter your server is a testing machine or production server, it’s strongly recommended to set a fully qualified domain name (FQDN) hostname.
Enter the following command to view the current hostname.
[root@linuxtweaks ~]# hostname -f linuxtweaks.in
Fully Qualified Domain Name
On Debian/Ubuntu Linux, hostname is set in two files: /etc/hostname and /etc/hosts. Edit /etc/hostname file to change the hostname.
vim /etc/hostname
and write your hostname.
linuxtweaks
Now, Edit /etc/hosts file static table lookup for hostnames. Warning: Please list the FQDN hostname as first item.
vim /etc/hosts
and write your FQDN as follows.
# Part of file: /etc/hosts
127.0.0.1 linuxtweaks.in linuxtweaks localhost localhost.localdomain
At last, Verify the FQDN hostname by running the following command. If it wasn’t changed after updating above two files, please reboot server to make it work.
[root@linuxtweaks ~]# hostname -f linuxtweaks.in