Centos7更改主机名
1 //查看一下当前主机名的情况,查看全部三种主机名
2
3 hostnamectl
4
5 //或者,查看全部三种主机名
6
7 hostnamectl status
//删除hostname
hostnamectl set-hostname ""
hostnamectl set-hostname "" --static
hostnamectl set-hostname "" --pretty
[root@localhost ~]# hostnamectl set-hostname hadoop100
[root@localhost ~]# hostnamectl --pretty
[root@localhost ~]# hostnamectl --static
hadoop100
[root@localhost ~]# hostnamectl --transient
hadoop100
手动更新/etc/hosts
1 vim /etc/hosts
2
3 #127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
4
5 127.0.0.1 hadoop100
6
7 #::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
8
9 ::1 hadoop100
关闭防火墙
systemctl status firewalld.service 查看防火墙状态
systemctl stop firewalld.service 关闭防火墙
systemctl disable firewalld.service, 禁止防火墙服务器