How to set a persistant FQDN for an Ubuntu 18.04 droplet?
I created a new droplet today. Named it ‘fred’. If I query the hostname, it returns 'fred’. If I ask for the FQDN via hostname –fqdn, I get 'fred’.
My DNS (external provider) is pointing at 'fred.example.org’.
Reading various articles here, I’ve tried changing the name of the droplet via the control panel (no change after a reboot), using the hostname command (lasts until the next reboot), using the hostnamectl command, which seems to change the hostname and the FQDN to 'fred.example.org’.
Normally, I’d change the hostname file and the resolv.conf file. But, both files have comments that they should be changed elsewhere in part of the cloud init system. Which seems to be tied into systemd.
This will be a mail server, eventually, and its really important to get the names set up properly.
I keep looking for a tutorial that would address this with the specifics of the Digital Ocean setup, but I’m not finding it.
What am I missing?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×