操作环境
[[email protected] ~]# uname Linux [[email protected] ~]# 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 [[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)
1、方法一使用hostnamectl命令
[[email protected] ~]# hostnamectl set-hostname centos702
2、方法二:修改配置文件 /etc/hostname 保存退出
[[email protected] ~]# vi /etc/hostname centos701 ~ ~ ~ ~ :wq [[email protected] ~]# reboot
原文地址:https://www.cnblogs.com/lyjing/p/8494727.html
时间: 2024-11-13 08:21:12