If the Ubuntu Server installer has set your server to use DHCP, you will want to change it to a static IP address so that people can actually use it.
如果Ubuntu Server安装程序已将服务器设置为使用DHCP,则需要将其更改为静态IP地址,以便人们可以实际使用它。
Changing this setting without a GUI will require some text editing, but that’s classic linux, right?
在没有GUI的情况下更改此设置将需要进行一些文本编辑,但这是经典的linux,对吗?
Let’s open up the /etc/network/interfaces file. I’m going to use vi, but you can choose a different editor
让我们打开/ etc / network / interfaces文件。 我将使用vi,但您可以选择其他编辑器
sudo vi /etc/network/interfaces
须藤vi / etc / network / interfaces
For the primary interface, which is usually eth0, you will see these lines:
对于通常是eth0的主接口,您将看到以下行:
auto eth0 iface eth0 inet dhcp
自动eth0 iface eth0 inet dhcp