參考文檔:
- 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
硬件環(huán)境:
3臺(tái)32G內(nèi)存服務(wù)器
操作系統(tǒng):
centos7-1511
網(wǎng)卡配置为朋,保證服務(wù)器都可以訪問(wèn)外網(wǎng):
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
關(guān)閉防火墻宇整,關(guān)閉selinux
安裝epel源阴绢,三臺(tái)服務(wù)器都操作
yum -y install epel-release
/etc/hosts偏灿,三臺(tái)服務(wù)器同樣配置:
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
配置主機(jī)名穿扳,server1,server2,server3
配置免密登陸(方法一)
Step1 三臺(tái)服務(wù)器上,ssh-keygen三次回車
Step2 將三個(gè)服務(wù)器下面的.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公鑰復(fù)制到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
三臺(tái)服務(wù)器上安裝Development Tools
# yum group list
# yum -y groupinstall "Development Tools"
配置三臺(tái)服務(wù)器時(shí)間同步
# ntpdate -u cn.pool.ntp.org
# timedatectl set-timezone Asia/Shanghai 執(zhí)行完后時(shí)間就變?yōu)楸本r(shí)間了
余下步驟參考官網(wǎng)文檔