参考文档:
- http://bbs.bk.tencent.com/forum.php?mod=viewthread&tid=505&extra=page%3D1
- http://bbs.bk.tencent.com/forum.php?mod=viewthread&tid=511
硬件环境:
3台32G内存服务器
操作系统:
centos7-1511
网卡配置,保证服务器都可以访问外网:
TYPE=Ethernet
BOOTPROTO=static
DEVICE=eno1
ONBOOT=yes
IPADDR=192.168.144.104
NETMASK=255.255.252.0
DNS1=127.0.0.1
DNS2=114.114.114.114
GATEWAY=192.168.147.254
关闭防火墙,关闭selinux
安装epel源,三台服务器都操作
yum -y install epel-release
/etc/hosts,三台服务器同样配置:
192.168.144.104 server1
192.168.144.105 server2
192.168.144.108 server3
192.168.144.104 jobs.blueking.com
192.168.144.104 cmdb.blueking.com
192.168.144.104 paas.blueking.com
配置主机名,server1,server2,server3
配置免密登陆(方法一)
Step1 三台服务器上,ssh-keygen三次回车
Step2 将三个服务器下面的.ssh/id_rsa.pub中的公钥收集到server1的.ssh/authorized_keys
[root@server1 ~]# cat .ssh/id_rsa.pub > .ssh/authorized_keys
[root@server2 ~]# cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDPJdc5o/LzAWD+8t2iZNR31011KqorynNvUkP6VlMvkISy6xN8Eqn90irxo4EHRzxLwflsNUv6VvC4DGi2aCkQEtarTCmN6UGPg2lPiMBZjqCH4fX5Fv1pAYlQWqxqoAmCZ3nmWSQlpXNNStcx4IDx8X9fI5MTS7Qx+URG5VJoSG5nY8sbX9KyK/sGwRvqJvGedLw+crop+/ze+C9sDAkHucbeIKRSzy9P72eHrKqiHDp5YUmHw3z57TLHXA1LGkgAJOTf3tVWnp58F8RUZ5koCs/BCz6wHAyZ0dFqhFMUY8cd4AspfJbNSRXzIDk4vvbOFUDnJ8FjwSuM5CX0Rh51 root@server2
...
[root@server1 ~]# cat .ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCgeBGVQVFLd9NFzJ1hIo23BJDWc18tDRhWWyOGfg/9obbJ+zkGsSVQmHDkuZ1vtiO9saDn0Pz5pxJxK4yAar01Ko5LdySOolvrXAPEQnK2VL5gQHokmn3UvqeRUGmyfWXlAj1b6E7IQLJG8HupBjM7YhtiRnNfVmaTsS0s10BCpPBmef5heZFZvG9UCkHwTNnOnQbn0maWZl8gW+wjQbR19/YzPMEFlVayOJ8JwZkFz76Iz7zEMZhvGqDuhw4r4u+Gqh60wfX7+3H2PqsqmiphlfPrcLEglpClbu32pHpkSFqOyR82ae/1T983BEomKQLcjHWoghy6pvBg06XZrtct root@server1
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDPJdc5o/LzAWD+8t2iZNR31011KqorynNvUkP6VlMvkISy6xN8Eqn90irxo4EHRzxLwflsNUv6VvC4DGi2aCkQEtarTCmN6UGPg2lPiMBZjqCH4fX5Fv1pAYlQWqxqoAmCZ3nmWSQlpXNNStcx4IDx8X9fI5MTS7Qx+URG5VJoSG5nY8sbX9KyK/sGwRvqJvGedLw+crop+/ze+C9sDAkHucbeIKRSzy9P72eHrKqiHDp5YUmHw3z57TLHXA1LGkgAJOTf3tVWnp58F8RUZ5koCs/BCz6wHAyZ0dFqhFMUY8cd4AspfJbNSRXzIDk4vvbOFUDnJ8FjwSuM5CX0Rh51 root@server2
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDe/quhYrwVmIaSVDEFmEP1OC+NCt1LtFYH8+B9jM36NNkgWg2Jjm2mmUFqi65uwm7grL00wXFInFceoXgPvtr3ex307vEFtj+R7NXR1fAqfef4CN/ul8ieVI0TQQhGr4lPIAEPDlgrMZLaiwmCCPtfXBKPq3NB4CEXLYJNpw36Gai/RmQoTTP5Z/BYH4DocsWKmznKegPYC97db25JfNsJfgWgYN9tlna0gvl7MbMXmH3BpwPHXQc1DGOwANaeF3388I6ZBXjxa0t6giXt9RerHGYiBNnt2J1CygMCtN8kJ53p3QRdJXuXQGnNQgBDr3A7w8ZnOkZr7D8rdn3e02Lx root@server3
Step3 将server1中的authorized_keys公钥复制到server2,server3中
[root@server1 ~]# scp .ssh/authorized_keys server3:~/.ssh/
root@server3's password:
authorized_keys 100% 1182 1.2KB/s 00:00
[root@server1 ~]# scp .ssh/authorized_keys server2:~/.ssh/
root@server2's password:
authorized_keys 100% 1182 1.2KB/s 00:00
配置免密登陆(方法二)
ssh-keygen -t rsa -b 2048
cat /root/.ssh/id_rsa.pub >/root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
for ip in $(awk '{print $1}' install.config); do
rsync -a /root/.ssh/authorized_keys root@$ip:/root/.ssh/
done
使用阿里pip源
[root@server1 ~]# cat /data/src/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com
三台服务器上安装Development Tools
# yum group list
# yum -y groupinstall "Development Tools"
配置三台服务器时间同步
# ntpdate -u cn.pool.ntp.org
# timedatectl set-timezone Asia/Shanghai 执行完后时间就变为北京时间了
余下步骤参考官网文档
网友评论