Modify linux hostname

1.

Open the file hostname

sudo vim /etc/hostname

 

Enter the host name you want, save and exit

Then restart you can find a host name changed to what you want, but this time run sudo will report a wrong unable to resolve host. .

Although not affect the use, but looked irritated

 

We can modify the hosts file to resolve

sudo vim /etc/hosts

In the document plus a

127.0.0.1  你设置的主机名

Save out

 

Guess you like

Origin blog.csdn.net/Lin_QC/article/details/91360720