centos 7 修改主機名

[root@centos7 ~]$ hostnamectl set-hostname salve1 # 使用這個命令會當即生效且重啓也生效
[root@centos7 ~]$ hostname # 查看下
salve1
[root@centos7 ~]$ vim /etc/hosts # 編輯下hosts文件, 給127.0.0.1添加hostname
[root@centos7 ~]$ cat /etc/hosts # 檢查
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 centos77.magedu.com
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.7 salve1vim

相關文章
相關標籤/搜索