在我机器上出错的原因是hostname没有配置,我的系统是ubuntu,hostname默认是ubuntu
用hostname命令可以查看当前的hostname
root@localhost:/home/simon# hostname
localhost
whereis hostname查找hostname配置所在的位置
root@localhost:/home/simon# whereis hostname
hostname: /bin/hostname /etc/hostname /usr/share/man/man1/hostname.1.gz /usr/share/man/man7/hostname.7.gz
用vim修改hostname为localhost,重启生效(可能不需重启。。)
root@localhost:/home/simon# vi /etc/hostname