操作环境:
[root@bogon ~]# uname -a
Linux #localhost.localdomain 3.10.0-514.el7.centos.plus.i686 #1 SMP Wed Jan 25 12:55:04 UTC 2017 i686 i686 i386 GNU/Linux
[root@bogon ~]# cat /etc/redhat-release
CentOS release 7.3.1611 (AltArch)
[root@bogon ~]#
实验要求:将centos7原主机名改为’NMserver-7.test.com'
1、方法一使用hostnamectl命令
[root@bogon ~]# hostnamectl set-hostname NMServer-7.test.com
2、方法二:修改配置文件 /etc/hostname 保存退出
[root@bogon ~]# vi /etc/hostname
nmserver-7.test.com
~
~
~
~
:wq
[root@bogon ~]# reboot
from:https://www.cnblogs.com/me80/p/7218488.html?utm_source=itdadao&utm_medium=referral