安装需求:

python >=2.6 <3.0

zeromq >=2.1.9

pyzmp >=2.1.9

pycrypto

msgpack-python

yaml

jinja2


1. yum源设置
#vim /etc/yum.repos.d/ epel.repo

[epel]

name=Extra Packages for Enterprise Linux 5 - $basearch

#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch

mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch

failovermethod=priority

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

[epel-debuginfo]

name=Extra Packages for Enterprise Linux 5 - $basearch - Debug

#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug

mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch

failovermethod=priority

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

gpgcheck=1

[epel-source]

name=Extra Packages for Enterprise Linux 5 - $basearch - Source

#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS

mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch

failovermethod=priority

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

gpgcheck=1
2.   YUM 安装 python26

#yum install python26 python26-devel


3.  源码安装

1>.安装pyyaml

下载libzmq-master

#yum install libtool autoconf automake

#unzip libzmq-master.zip

#cd libzmq-master

#./autogen.sh

注:如果还报错,会有提示说autoconf版本太低,去官网下载高版本

wgethttp://ftp.gnu.org/gnu/autoconf/autoconf-2.64.tar.gz

下载pyyaml

https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz

#tar zxvf PyYAML-3.10.tar.gz

#cd PyYAML-3.10

#python setup.py install


2>.安装markupsafe

https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.19.tar.gz

#tar zxvf MarkupSafe-0.19.tar.gz

#python setup.py install

3>.安装jinja2

#tar zxvf Jinja2-2.7.2.tar.gz

#cd Jinja2-2.7.2

#python setup.py install

4>.安装pyzmq

下载zeromq

wget wgethttp://download.zeromq.org/zeromq-2.2.0.tar.gz

#yum install libtool autoconf automake uuid-devel

#tar zxvf zeromq-3.2.4.tar.gz

#cd zeromq-3.2.4

#./configure

#make && make install

#ldconfig

下载pyzmq

(wgethttps://github.com/downloads/zeromq/pyzmq/pyzmq-2.2.0.1.tar.gz)

#tar zxvf pyzmq-2.2.0.1.tar.gz

#cd pyzmq-2.2.0.1

#python setup.py install

注意:pyzmq版本要与zeromq版本一致

如果确实安装不过去,一直报错,请用yum安装

#yum install python26-zmq

5>.安装M2Crypto

https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-0.22.3.tar.gz

#tar zxvf M2Crypto-0.22.3.tar.gz

#cd M2Crypto-0.22.3

#python setup.py install

6>.安装msgpack

https://pypi.python.org/packages/source/m/msgpack-python/msgpack-python-0.4.1.tar.gz

#tar zxvf msgpack-python-0.4.1.tar.gz

#cd msgpack-python-0.4.1

#python setup.py install

7>.安装pycrypto

(https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz)

#tar zxvf pycrypto-2.6.1.tar.gz

#cd pycrypto-2.6.1

#python setup.py install

8>.安装salt-0.17

#unzip salt-0.17.zip

#cd salt-0.17

#python setup.py install

#mkdir /etc/salt


Master端配置

#cp conf/master /etc/salt/

#cp pkg/suse/salt-master /etc/init.d/

#chmod +x /etc/init.d/salt-master

#chkconfig --add salt-master

#chkconfig salt-master on

#vim /etc/salt/ master

interface: 0.0.0.0

log_file: /var/log/salt/master      #记录主控端运行日志

key_logfile: /var/log/salt/key      #记录认证证书日志

注:去掉面的注释就行

启动salt-master

#service salt-master start

注:如果没进程的话,查看启动脚本(/etc/init.d/salt-master)里对应的python或者salt-master程序路径是否正确

#which salt-master或者which python

行数which是否对应上

32     SALTMASTER=/usr/bin/salt-master

33     PYTHON=/usr/bin/python


Minion配置

#cp conf/minion /etc/salt/

#cp pkg/suse/salt-minion /etc/init.d/

#chmod +x /etc/init.d/salt-minion

#chkconfig --add salt-minion

#chkconfig salt-minion on

#vim /etc/salt/minion

master: master-ip          #设置主控端IP

id: test-server-minion           #设定受控端编号

log_file: /var/log/salt/minion  #记录受控端运行日志

key_logfile: /var/log/salt/key  #记录认证证书日志


启动salt-minion

#service salt-minion start

注:如果没进程的话,查看启动脚本(/etc/init.d/salt-minion)里对应的python或者salt-master程序路径是否正确

#which salt-master或者which python

行数程序路径

32     SALTMINION=/usr/local/bin/salt-minion

33     PYTHON=/usr/local/bin/python