Change hostname, domain or FQDN permanently

Change hostname, domain or FQDN permanentlyChange hostname, domain or FQDN permanently. Setting the hostname with the hostname command will reset after a reboot. To make it permanent.
To check the hostname, just do:


Hostname

root@mail:~# hostname
mail

Domain Name
root@mail:~# hostname -d
example.com

FQDN (Fully Qualified Domain Name)
root@mail:~# hostname -f
mail.example.com

Open the /etc/hostname to change the hostname.
Open the /etc/hosts to change the Domain name and FQDN.

127.0.0.1 localhost
127.0.1.1 mail.example.com mail

Change the Domain and FQDN in the second line in the hosts file.
Apply with /etc/init.d/hostname.sh start

If you are looking for how to change the hostname on Debian 9, click this link.

If you want a see a video on how this is done. Have a look at this video!

Thats all on Change hostname, domain or FQDN permanently

Happy renaming!

2 thoughts on “Debian – Change hostname, domain or FQDN permanently”

Leave a Reply