美文网首页
centos7修改主机名

centos7修改主机名

作者: CUFFS | 来源:发表于2017-02-22 10:21 被阅读65次
  • 首先我们需要先把centos的网络配置文件,/etc/sysconfig/network 把hostname栏目修改
[root@localhost ~]# vi /etc/sysconfig/network
[root@localhost ~]# 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
[root@localhost ~]# cat /etc/hostname 
hm01
[root@localhost ~]# ^C

  • 重启电脑
    shutdown -r now 或者 reboot
[root@hm01 ~]# hostname
hm01
[root@hm01 ~]# ^C
[root@hm01 ~]# 

相关文章

网友评论

      本文标题:centos7修改主机名

      本文链接:https://www.haomeiwen.com/subject/icipwttx.html