1.查看当前主机名
>> hostname #使用root用户
2.修改/etc/sysconfig/network文件
vi /etc/sysconfig/network #将HOSTNAME后面的值改为想要设置的主机名
3.修改/etc/hosts文件
>> vi /etc/hosts #将localhost.localdomain改为想要设置的主机名
4.重启服务器
>> reboot
1.查看当前主机名
>> hostname #使用root用户
2.修改/etc/sysconfig/network文件
vi /etc/sysconfig/network #将HOSTNAME后面的值改为想要设置的主机名
3.修改/etc/hosts文件
>> vi /etc/hosts #将localhost.localdomain改为想要设置的主机名
4.重启服务器
>> reboot
转载于:https://www.cnblogs.com/jackgaolei/p/5038249.html