centos7更改主机

方法一:

[root@localhost zz]# hostnamectl set-hostname  mycomputer
[root@localhost zz]# uname -a
Linux mycomputer 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

方法二:


[root@localhost zz]# vi /etc/hostname

[root@localhost zz]#reboot

在hostname文件中加入主机名“mycomputer_test ”,然后重启,重启后可以看到主机名已经修改

[zz@mycomputer_test ~]$ 

猜你喜欢

转载自blog.csdn.net/qq_43153291/article/details/82885507