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.

[[email protected] ~]# 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.

[[email protected] ~]# hostname -f
linuxtweaks.in

 

 

Balvinder Singh

Hello, I am Balvinder Singh - DevOps Engineer with 2.5+ year of working experience with different server environments. Tag Line:-Linux | AWS| WHM |Monitoring | Virtualization | Optimization | Performance | Security | Release & Deployment. I love helping companies / clients to deploy their code / applicateions to well managed, optimized, secure server and can go extra mile to satisfy.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *