###安装相关依赖包
yum -y install gcc libyaml libtool python-devel gcc-c++ swig openssl-devel
###初始化相关路径
mkdir -p /export/data/salt-master/pki/master mkdir -p /export/Logs/salt-master/log/master mkdir -p /export/data/salt-master/key/key mkdir -p /export/data/salt-master/pid/salt-master.pid mkdir -p /export/data/salt-master/cache/master
###以下模块可在http://github.com/下载
cd /usr/local/src && tar xvf setuptools-7.0.tar.gz && cd setuptools-7.0 /usr/bin/python setup.py install cd ../ && tar xvf MarkupSafe-0.23.tar.gz && cd MarkupSafe-0.23 /usr/bin/python setup.py install cd ../ && tar xvf Jinja2-2.7.3.tar.gz && cd Jinja2-2.7.3 /usr/bin/python setup.py install cd ../ && tar xvf pycrypto-2.6.1.tar.gz && cd pycrypto-2.6.1 /usr/bin/python setup.py install cd ../ && tar xvf requests-2.4.3.tar.gz && cd requests-2.4.3 /usr/bin/python setup.py install cd ../ && unzip libzmq-master.zip && cd libzmq-master sh autogen.sh cd ../ && tar xvf pyzmq-14.4.1.tar.gz && cd pyzmq-14.4.1 /usr/bin/python setup.py install cd ../ && tar xvf M2Crypto-0.22.3.tar.gz && cd M2Crypto-0.22.3 /usr/bin/python setup.py install cd ../ && tar xvf msgpack-python-0.4.2.tar.gz && cd msgpack-python-0.4.2 /usr/bin/python setup.py install cd ../ && tar xvf PyYAML-3.10.tar.gz && cd PyYAML-3.10 /usr/bin/python setup.py install cd ../ && unzip salt-2015.2.zip && cd salt-2015.2 /usr/bin/python setup.py install
###创建master配置文件
mkdir -p /etc/salt/ cat >/etc/salt/minion<<EOF default_include: minion.d/*.conf master: 192.168.159.90 user: admin pki_dir: /export/data/salt-minion/pki/minion log_file: /export/Logs/salt-minion/log/minion key_logfile: /export/data/salt-minion/key/key pidfile: /export/data/salt-minion/pid/salt-minion.pid cachedir: /export/data/salt-minion/cache/minion id: 192.168.1.1 log_level: error log_level_logfile: error log_datefmt: '%H:%M:%S' log_fmt_console: '[%(levelname)-8s] %(message)s' EOF
####配置开机启动
cp -f /usr/local/src/salt-2015.2/pkg/rpm/salt-master /etc/init.d/ chmod a+x /etc/init.d/salt-master /sbin/chkconfig --add salt-master /sbin/chkconfig salt-master on
###安装完成,启动服务
service salt-master start