CENTOS7 永久更改主机名

admin2020-12-15Linux495

环境信息:

[root@xlucas1 ~]# uname -a
Linux xlucas1 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@xlucas1 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
1
2
3
4
实验要求:将centos7原主机名改为’xlucas2’

1、方法一使用hostnamectl命令

[root@xlucas1 ~]# hostnamectl set-hostname xlucas2
1
2、方法二:修改配置文件 /etc/hostname 保存退出

[root@xlucas1 ~]# vi /etc/hostname
xlucas2


发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。