重命名 DO droplet 和 Ubuntu 主机名

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.

只是快速更新一下——我做了上述操作,没有做其他事情,似乎也没有破坏任何东西 :slight_smile:

这应该没问题。最“规范”的做法是将 Droplet 的名称设置为主机名,以便反向 IP 查询能够正常工作。如果你只运行 Discourse,机器自身对主机名的认知并不重要。

谢谢。我最终将主机名设为了与我的 Droplet 名称相同——“Discourse”(即反过来),希望这样能达到同样的效果 :slight_smile:

1 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.