1.查看当前主机名
使用root用户
# hostname
2.修改/etc/sysconfig/network文件
# vi /etc/sysconfig/network
将HOSTNAME后面的值改为想要设置的主机名]
3.修改/etc/hosts文件
# vi /etc/hosts
将localhost.localdomain改为想要设置的主机名
4.重启服务器
# reboot
使用root用户
# hostname
# vi /etc/sysconfig/network
将HOSTNAME后面的值改为想要设置的主机名]
# vi /etc/hosts
将localhost.localdomain改为想要设置的主机名
# reboot