Linux基础操作----sudo: unable to resolve host错误


Ubuntu 在每次执行命令的时候,会报如下错误:

tianmai@iZebgilejo9idbZ:/root$ sudo service nginx start
sudo: unable to resolve host iZebgilejo9idbZ
iZebgilejo9idbZ  是阿里云创建服务器默认的hostname,这个错误其实对于实际操作没有影响 ,但是强迫症患者很不舒服

错误原因:

因为/etc/hosts下的主机名和/etc/hostname下的主机名不一致所导致的错误

所以讲两个改为一致即可~

解决方式:

1、修改hostname文件内容(iZebgilejo9idbZ改 为localhost)

root@iZebgilejo9idbZ:~# vim /etc/hostname
iZebgilejo9idbZ 换成 localhost

2、或者修改hosts文件内容,,只有修改为一致就可以

root@iZebgilejo9idbZ:~# vim /etc/hostname
127.0.0.1       localhost    iZebgilejo9idbZ(去掉这个) 
3、重启服务器就完成了

猜你喜欢

转载自blog.csdn.net/tian_panda/article/details/80921596