1. 环境准备

1.1防火墙

sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/selinux/config

setenforce 0

systemctl stop firewalld

systemctl disable firewalld

1.2同步时间

rm -rf /etc/localtime

ln -sf  /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

#提前选择时区,然后配置时间

yum install ntp -y

systemctl  enable    ntpd

systemctl  start     ntpd

#安装ntp服务,并启动。

ntpdate -u 192.168.101.46

echo "0 0 * * * /usr/sbin/ntpdate -u 192.168.101.46" >> /var/spool/cron/root

配置定时同步

1.3节点免登录

ssh-keygen -t rsa

cat  .ssh/id_rsa.pub >>authorized_keys

vim /etc/ssh/sshd_config

 

重启ssh服务,验证无误后,scp到其他节点。

systemctl restart sshd

拷贝到其他服务器上

scp -rp /etc/ssh/sshd_config 192.168.101.54:/etc/ssh/sshd_config

scp -rp /etc/ssh/sshd_config 192.168.101.55:/etc/ssh/sshd_config

scp -rp /etc/ssh/sshd_config 192.168.101.56:/etc/ssh/sshd_config

权限说明,其余默认644

chmod 600 authorized_keys

chmod 600 id_rsa

拷贝到其他服务器上

scp -rp .ssh/* 192.168.101.54:/root/.ssh/

scp -rp .ssh/* 192.168.101.55:/root/.ssh/

scp -rp .ssh/* 192.168.101.56:/root/.ssh/

1.4同步hosts文件

 

scp -rp /etc/hosts 192.168.101.54:/etc/

scp -rp /etc/hosts 192.168.101.55:/etc/

scp -rp /etc/hosts 192.168.101.56:/etc/