#!/bin/bash
#openssl安装
rpm -U openssl-1.0.1e-16.el6_5.14.x86_64.rpm
rpm -U openssl-devel-1.0.1e-16.el6_5.14.x86_64.rpm --nodeps
#安装其他相关包
yum -y install krb5-devel
yum -y install autoconf
yum -y install automake
#Python-2.7.10 安装
cd /home/gaofengkun/
tar xvzf Python-2.7.10.tgz
cd /home/gaofengkun/Python-2.7.10
./configure --prefix=/usr/local
make
make install
## 将python头文件拷贝到标准目录,以避免编译saltstack时,找不到所需的头文件
cd /usr/local/include/python2.7
cp -a ./* /usr/local/include/
## 备份旧版本的python,并符号链接新版本的python
cd /usr/bin
yes | mv python python2.6
ln -s /usr/local/bin/python
## 修改yum脚本,使其指向旧版本的python,已避免其无法运行
sed -i 's/python/python2.6/' /usr/bin/yum
sleep 3
#PyYAML模块安装
cd /home/gaofengkun/
tar xvzf yaml-0.1.5.tar.gz
cd /home/gaofengkun/yaml-0.1.5
./configure --prefix=/usr/local
make
make install
sleep 3
cd /home/gaofengkun/
tar xvzf PyYAML-3.11.tar.gz
cd /home/gaofengkun/PyYAML-3.11
python setup.py install
sleep 3
#setuptools模块安装
cd /home/gaofengkun/
tar xvzf setuptools-7.0.tar.gz
cd /home/gaofengkun/setuptools-7.0
python setup.py install
sleep 3
#markupsafe模块安装
cd /home/gaofengkun/
tar xvzf MarkupSafe-0.9.3.tar.gz
cd /home/gaofengkun/MarkupSafe-0.9.3
python setup.py install
sleep 3
#jinja2模块安装
cd /home/gaofengkun/
tar xvzf Jinja2-2.7.3.tar.gz
cd /home/gaofengkun/Jinja2-2.7.3
python setup.py install
sleep 3
#pyzmq模块安装
#:系统自带的autoconf版本为2.63,在编译ZeroMQ时,由于版本较低,会报错不通过,故需安装大于2.63的版本。
cd /home/gaofengkun/
tar xvzf autoconf-2.69.tar.gz
cd /home/gaofengkun/autoconf-2.69
./configure --prefix=/usr
make
make install
## 其他依赖库安装
yum -y install libuuid.x86_64 libuuid-devel.x86_64
yum -y install uuid.x86_64 uuidd.x86_64
yum -y install libtool
yum install python-devel -y
#http://rpm.pbone.net/
rpm -ivh uuid-c++-1.6.1-10.el6.x86_64.rpm
rpm -ivh uuid-devel-1.6.1-10.el6.x86_64.rpm
rpm -ivh uuid-c++-devel-1.6.1-10.el6.i686.rpm --nodeps
cd /home/gaofengkun/
tar xvzf libsodium-1.0.3.tar.gz
cd /home/gaofengkun/libsodium-1.0.3
./autogen.sh
./configure --prefix=/usr/local
make
make install
cd /home/gaofengkun/
tar xvzf zeromq-4.0.5.tar.gz
cd /home/gaofengkun/zeromq-4.0.5
./autogen.sh
./configure --prefix=/usr/local
make
make install
cd /home/gaofengkun/
tar xvzf pyzmq-14.7.0.tar.gz
cd /home/gaofengkun/pyzmq-14.7.0
python setup.py configure --zmq=/usr/local
python setup.py install
sleep 3
#M2Crypto模块安装
cd /home/gaofengkun/
tar zxvf swig-3.0.0.tar.gz
cd /home/gaofengkun/swig-3.0.0
./autogen.sh
./configure --without-pcre
make
make install
cd /home/gaofengkun/
tar xvzf M2Crypto-0.22.3.tar.gz
cd /home/gaofengkun/M2Crypto-0.22.3
env SWIG_FEATURES="-cpperraswarn -includeall -I/usr/include/openssl" python setup.py install
#msgpack模块安装
cd /home/gaofengkun/
tar xvzf msgpack-python-0.4.2.tar.gz
cd /home/gaofengkun/msgpack-python-0.4.2
python setup.py install
#msgpack-pure模块安装
cd /home/gaofengkun/
tar xvzf msgpack-pure-0.1.3.tar.gz
cd /home/gaofengkun/msgpack-pure-0.1.3
python setup.py install
#pycrypto模块安装
cd /home/gaofengkun/
tar xvzf pycrypto-2.6.1.tar.gz
cd /home/gaofengkun/pycrypto-2.6.1
python setup.py install
#requests模块安装
cd /home/gaofengkun/
tar xvzf requests-2.5.0.tar.gz
cd /home/gaofengkun/requests-2.5.0
python setup.py install
cd /home/gaofengkun/
tar xzvf libnacl-1.4.3.tar.gz
cd /home/gaofengkun/libnacl-1.4.3
python setup.py install
cd /home/gaofengkun/
tar xzvf ioflo-1.0.2.tar.gz
cd /home/gaofengkun/ioflo-1.0.2
python setup.py install
cd /home/gaofengkun/
tar xzvf six-1.8.0.tar.gz
cd /home/gaofengkun/six-1.8.0
python setup.py install
cd /home/gaofengkun/
tar xzvf raet-0.4.2.tar.gz
cd /home/gaofengkun/raet-0.4.2
python setup.py install
cd /home/gaofengkun/
tar xzvf Mako-1.0.0.tar.gz
cd /home/gaofengkun/Mako-1.0.0
python setup.py install
cd /home/gaofengkun/
tar xvzf salt-2015.5.2.tar.gz
cd /home/gaofengkun/salt-2015.5.2
python setup.py install
salt --versions-report
此脚本需要系统提前安装好gcc并配置好相应的yum源。
# salt-master
cd /home/gaofengkun/salt-2015.5.2
mkdir /etc/salt
cp -a conf/master /etc/salt/
cp -a pkg/suse/salt-master /etc/init.d/
chmod +x /etc/init.d/salt-master
chkconfig --level 235 salt-master on
mkdir -p /var/log/salt/srv/salt
echo " interface: $1 >> /etc/salt/master
echo " auto_accept: True >> /etc/salt/master
ln -s /usr/local/bin/salt-master /usr/bin/
service salt-master start
# salt-minion
cd /home/gaofengkun/salt-2015.5.2
mkdir /etc/salt
cp -a conf/minion /etc/salt/
cp -a pkg/suse/salt-minion /etc/init.d/
chmod +x /etc/init.d/salt-minion
chkconfig --level 235 salt-minion on
mkdir -p /var/log/salt
echo " master: $1 >> /etc/salt/minion
echo " id: minion-hostname >> /etc/salt/minion
ln -s /usr/local/bin/salt-minion /usr/bin/
service salt-minion start
service iptables stop
service ip6tables stop
chkconfig iptables off
chkconfig ip6tables off
#test shell
salt-key -L
salt '*' test.ping
salt '*' cmd.run 'uptime'
salt -G 'os:Centos' test.ping
salt -G 'os:redhat' test.ping
salt '*' grains.item os
$1 指定 master IP 地址。