安装
https://blog.csdn.net/babyxue/article/details/80970526
主机环境预设
更换国内yum源 epel源
https://www.cnblogs.com/hanbowen/p/11563388.html
设置时间同步
https://www.cnblogs.com/hanbowen/p/11563757.html
yum install -y chrony
systemctl start chronyd
systemctl status chronyd
配置静态ip
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static #启用静态IP地址
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=6c6759a1-38b9-4421-b06b-aa4d783ea247
DEVICE=ens33
ONBOOT=yes #开启自动启用网络连接
IPADDR=192.168.199.200 #设置IP地址
GATEWAY=192.168.199.1 #设置网关
NETMASK=255.255.255.0 #设置子网掩码
# PREFIXO0=24 #二选一 设置子网掩码
DNS1=114.114.114.114 #设置主DNS
DNS2=8.8.8.8 #设置备DNS
:wq! #保存退出
service network restart #重启网络
ping www.baidu.com #测试网络是否正常
关闭防火墙 firewalld iptables
systemctl status firewalld
systemctl stop firewalld # 临时关闭防火墙
systemctl disable firewalld # 禁止开机启动
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2019-08-25 00:05:51 CST; 11h ago
Docs: man:firewalld(1)
Main PID: 593 (firewalld)
CGroup: /system.slice/firewalld.service
└─593 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sun 2019-08-25 11:39:50 CST; 2s ago
Docs: man:firewalld(1)
Process: 593 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 593 (code=exited, status=0/SUCCESS)
systemctl disable firewalld
[root@localhost ~]# systemctl status iptables
Unit iptables.service could not be found.
重启网络服务
service network restart
生成密钥传到各个节点去 让他们可以互相连接
[root@master ~]# ssh-keygen -t rsa -C "hbw1992@sina.com"
[root@master ~]# cd .ssh/
[root@master .ssh]# ll
total 12
-rw------- 1 root root 1679 Aug 25 12:36 id_rsa
-rw-r--r-- 1 root root 398 Aug 25 12:36 id_rsa.pub
-rw-r--r--. 1 root root 191 Aug 19 22:03 known_hosts
cat id_rsa.pub
[root@master .ssh]# vi .ssh/authorized_keys
把id_rsa.pub加进去
[root@master ~]# scp -r /root/.ssh node1:/root/
配置hosts
vi /etc/hosts
192.168.199.200 master1.hbw.com master1
192.168.199.201 node1.hbw.com node1
192.168.199.202 node2.hbw.com node2
192.168.116.203 node3.hbw.com node3
scp /etc/hosts node1:/etc/hosts
reboot #重启系统
设置主机名为master1.hbw.com(配置hosts了不用做这步)
hostname master1.hbw.com #设置主机名为master1.hbw.com
vi /etc/hostname #编辑配置文件
master1.hbw.com #修改localhost.localdomain为master1.hbw.com
:wq! #保存退出
vi /etc/hosts #编辑配置文件
127.0.0.1 localhost master1.hbw.com #修改localhost.localdomain为master1.hbw.com
:wq! #保存退出
shutdown -r now #重启系统