A question can only have one accepted answer. Are you sure you want to replace the current answer with this one?
You previously marked this answer as accepted. Are you sure you want to unaccept it?
Write for DigitalOcean
You get paid, we donate to tech non-profits.
Find and meet other developers in your city.
Contribute to Open Source
See the answers over at How to change a droplet name, and all associated configurations?.
Add comments here to get more clarity or context around a question. To answer a question, use the “Answer” field below.
I renamed the droplet into my primary domain ( somename.com ), what will be the ideal update in /etc/hostname and /etc/hosts
Just curious. Why can’t the hostname be changed automatically in those two places when we perform a rename in the control panel?
From what I understand that would require taking your server down, applying the change, and then taking it back up. Also it could conflict with some other settings you have on your computer, so probably not worth the trouble in most cases. Plus there is no real need for the names to be the same.
Do you mean to reboot Apache or the entire server? sude reboot I guess.
Today (2017) the interface enabling direct name change: at the page of your Cloud Panel (cloud.digitalocean.com/droplets…), simply click on the current name of the Droplet, and you will then be able to input whatever name you choose. Thanks @MikeG.
“also edit your droplet’s hostname internally as well. Update /etc/hostname and /etc/hosts and reboot.”
This is still necessary.
the original image link is offline. Settings > Rename
These settings are gone now…
If you are using CentOS you need to update this file /etc/sysconfig/network
Contents of this file:
so just change HOSTNAME and that’s it
If you are using CentOS you need to update this file /etc/sysconfig/network does not extist on my centos 6.5 droplet.
and neither do etc/hosts or etc/hostnames on my ubuntu droplet
You can type !ref in this text area to quickly search our full set of tutorials, documentation &
marketplace offerings and insert the link!