首页 > 其他 > 详细

centos7更改主机名

时间:2018-03-02 19:27:17      阅读:212      评论:0      收藏:0      [点我收藏+]

操作环境

[root@centos701 ~]# uname
Linux
[root@centos701 ~]# uname -a
Linux centos701 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@centos701 ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

1、方法一使用hostnamectl命令

[root@centos701 ~]# hostnamectl set-hostname centos702

2、方法二:修改配置文件  /etc/hostname 保存退出

[root@centos701 ~]# vi /etc/hostname 

centos701
~                                                                                                                                                            
~                                                                                                                                                            
~                                                                                                                                                            
~                                                                                                                                                            
                                                                                                                                                          
:wq
[root@centos701 ~]# reboot

 

centos7更改主机名

原文:https://www.cnblogs.com/lyjing/p/8494727.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!