Hi,
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?
Thanks,
johnbo
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Hello,
I believe that there are 3 things that you need to do:
hostnamectl
command:hosts
file:Find the references to the old FQDN and update them to the new one.
cloud.cfg
file. Edit the following file:Find the reference for
preserve_hostname
and change it fromfalse
totrue
.That is pretty much it, you can try to reboot your server and then test the change by running only the
hostnamectl
command.Hope that this helps! Regards, Bobby