首先获取hostname:

hostname

然后编辑/etc/hosts文件,加入以下内容:

127.0.0.1 localhost 你的hostname