修改hostname文件(路径:/etc/hostname) vim /etc/hostname,把hostname文件里面所有原来的名称改成你想要的名称; 主机名同时也保存在/etc/hosts文件中 需要把当前IP地址对应的主机名修改为hostname文件中的名称(路径:/etc/hosts)。 reboot重启机器