Renaming DO droplet and Ubuntu hostname

My Digital Ocean droplet has a long name including “…1vcpu-1gb-…”. Now that I’ve resized the droplet from its humble beginnings, that’s no longer accurate. I’d like just to call it “Discourse”. Apart from changing it on the Digital Ocean web interface, what else do I need to do?

I think I’d also need to

  1. sudo hostnamectl set-hostname Discourse
  2. sudo nano /etc/hosts to edit the first line to say 127.0.1.1 oldname newname (i.e. 127.0.1.1 ...1vcpu-1gb-... Discourse).

Anything else? Thanks.

Just a quick update - I did the above, and nothing else, and don’t seem to have broken anything :slight_smile:

That should be fine. The most “proper” thing to do is to make the droplet name your hostname so that reverse ip lookups work. The machine’s notion of its hostname doesn’t matter much if you’re running just discourse.

Thanks. I’ve ended up making my hostname the same as my droplet name - “Discourse” - (ie the other way round) so hopefully that has the same effect :slight_smile:

1 Like