centos7修改主机名
程序员文章站
2022-03-12 21:18:34
...
- 首先我们需要先把centos的网络配置文件,/etc/sysconfig/network 把hostname栏目修改
[[email protected] ~]# vi /etc/sysconfig/network
[[email protected] ~]# cat /etc/sysconfig/network
# Created by anaconda
HOSTNAME=hm01
- 修改/etc/hosts文件
vi /etc/hosts
127.0.0.1 localhost.localdomain #修改localhost.localdomain为orcl1
- 快捷修改vi /etc/hostname
[[email protected] ~]# cat /etc/hostname
hm01
[[email protected] ~]# ^C
- 重启电脑
shutdown -r now 或者 reboot
[[email protected] ~]# hostname
hm01
[[email protected] ~]# ^C
[[email protected] ~]#
下一篇: centOS7修改主机名