salt-stack-非标准安装(源码安装)-redhat6.5源码安装salt

一,简介

简单先介绍下环境,笔者所运维的环境基本上以redhat和CentOS为主。CentOS系统的版本也从5.4到6.8都有包括,进尔导致salt所依赖的python语言环境的版本也从2.4.3到2.6.6都有。因为是线上的系统,系统版本的升级或者python版本的升级,都有可能带来一定的风险性。所以从本意上来说,这次做的salt安装,最好不要对线上环境有任何的影响。

二,官方文档说:安装需求

python >=2.6 <3.0

zeromq >=2.1.9

pyzmp >=2.1.9

pycrypto

msgpack-python

yaml

jinja2

 

根据官方文档的要求开始准备软件:

序号 软件包 下载连接 报错
1 libzmq-master.zip https://github.com/zeromq/libzmq 安装pyzmq报错,其中有一段 - Failed with default libzmq, trying again with /usr/local
2 PyYAML-3.10.tar.gz https://pypi.python.org/pypi/PyYAML/3.10#downloads 启动master报错 - ImportError: No module named yaml
3 MarkupSafe-0.18.tar.gz https://pypi.python.org/simple/MarkupSafe/ 安装jinja2报错 - error: Could not find suitable distribution for Requirement.parse('markupsafe')
4 Jinja2-2.7.1.tar.gz https://pypi.python.org/pypi/Jinja2/2.7.1 启动master报错 - ImportError: No module named jinja2
5 pyzmq-13.1.0.tar.gz https://pypi.python.org/pypi/pyzmq/13.1.0#downloads 启动master报错 - ImportError: No module named zmq
6 M2Crypto-0.21.1.tar.gz https://pypi.python.org/pypi/M2Crypto/0.21.1 启动master报错 - ImportError: No module named M2Crypto
7 msgpack-python-0.3.0.tar.gz https://pypi.python.org/pypi/msgpack-python/0.3.0 安装m2crypto报错 - /usr/include/openssl/opensslconf.h:31: Error: CPP #error ""This openssl-devel package does not work your architecture?"". Use the -cpperraswarn option to continue swig processing.
8 pycrypto-2.6.tar.gz https://pypi.python.org/pypi/pycrypto/2.6 master和minion在运行一段时间后会报以下错误 - NameError: global name 'AES' is not defined
9 virtualenv-15.1.0.tar.gz https://pypi.python.org/pypi/virtualenv/ [WARNING ] virtualenv not installed, please install first
10 Python-2.7.5.tar.bz2 https://www.python.org/download/releases/2.7.5/ 升级python

三,升级系统python

本文介绍redhat6.5从自带的Pyhon版本是2.4升级到2.7.5的方法。因为redhat系统中旧版本的Python已被深度依赖,所以不能卸载原有的Python,只能全新安装。

1.下载Pyhon,选择下载Gzipped source tar ball (2.7.5) (sig)

网址https://www.python.org/download/releases/2.7.5

2.解压安装,命令如下

tar -xvf Python-2.7.5.tgz

cd Python-2.7.5

./configure --prefix=/usr/local/python2.7

make

make install

3.创建链接来使系统默认python变为python2.7

ln -fs /usr/local/python2.7/bin/python2.7 /usr/bin/python

4.查看Python版本

python –V

5.修改yum配置(否则yum无法正常运行)

vi /usr/bin/yum

将第一行的#!/usr/bin/python修改为系统原有的python版本地址#!/usr/bin/python2.4,至此redhat6.5系统Python已成功升级至2.7.5版本

三,源码安装salt  

1,安装libzmq-master    ---如果报错,需要先升级autoconf 

[root@ntpserver libzmq-master]# sh autogen.sh 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I config
configure.ac:3: error: Autoconf version 2.61 or higher is required
configure.ac:3: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
aclocal: autom4te failed with exit status: 63
autoreconf: aclocal failed with exit status: 63
autogen.sh: error: autoreconf exited with status 0

2,升级autoconf

[root@localhost ]# rpm -e autoconf-2.59-12  --nodeps 
[root@localhost ]# wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz 
[root@localhost ]# tar zxvf autoconf-2.68.tar.gz 
[root@localhost ]# cd autoconf-2.68 
[root@localhost autoconf-2.68]# ./configure --prefix=/usr/local 
[root@localhost autoconf-2.68]# make&& make install 
[root@localhost autoconf-2.68]# /usr/bin/autoconf -V 
autoconf (GNU Autoconf) 2.68

3,安装PyYAML-3.10

wget --no-check-certificate https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz#md5=74c94a383886519e9e7b3dd1ee540247
tar xzvf PyYAML-3.10.tar.gz
cd PyYAML-3.10
python setup.py install

4,安装MarkupSafe

wget --no-check-certificate https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz
tar xzvf MarkupSafe-0.23.tar.gz
cd MarkupSafe-0.23
python setup.py install

5,安装Jinja

wget --no-check-certificate https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
tar zxvf Jinja2-2.7.3.tar.gz
cd Jinja2-2.7.3
python setup.py install

6,安装pyzmq

wget --no-check-certificate https://pypi.python.org/packages/source/p/pyzmq/pyzmq-14.3.1.tar.gz#md5=7196b4a6fbf98022f17ffa924be3d68d
tar xzvf pyzmq-14.3.1.tar.gz
cd pyzmq-14.3.1
python setup.py install

7,安装msgpack

wget --no-check-certificate https://pypi.python.org/packages/source/m/msgpack-python/msgpack-python-0.4.2.tar.gz
tar xzvf msgpack-python-0.4.2.tar.gz
cd msgpack-python-0.4.2
python setup.py install

8,安装M2Crypto

若swig的版本小于1.3.29,则先安装新版本的swig-2.0.0

$ tar zxvf swig-2.0.0.tar.gz
$ cd swig-2.0.0
$ ./configure --prefix=$HOME/local/swig
$ make && make install
# 设置$HOME/local/swig/bin 到环境变量PATH,替换原来的swig
$ source ~/.bash_profile

若出现错误提示1:“This openssl-devel package does not work your architecture?”

则修改setup.py文件,将#'-Di386' 的注释去掉 (或直接下载已修改好的setup.py 文件替换原来的)

若出现错误提示2:“/usr/include/openssl/opensslconf.h:13: Error: Unable to find 'opensslconf-i386.h'”

#yum install openssl-1.0.1e-15.el6.i686
#yum install openssl-devel-1.0.1e-15.el6.i686
#则先将'opensslconf-i386.h'复制到当前目录
#cp /usr/include/openssl/opensslconf-i386.h ./

然后重新安装:

pyton setup.py install

9,安装virtualenv

下载地址:https://pypi.python.org/pypi/virtualenv/
tar -zxvf virtualenv-15.1.0.tar.gz 
cd virtualenv-15.1.0
python setup.py install

10,安装salt

wget https://pypi.python.org/pypi/salt
cd salt
python setup.py install
11,源码安装后,还需要手动拷贝配置文件模板到/etc/salt/内
cp salt-0.17.0/conf/master /etc/salt/
cp salt-0.17.0/conf/minion /etc/salt/

12,正确安装完毕后可以看到一批salt命令

[root@localhost ~]# salt
salt salt-call salt-cp salt-key salt-master salt-minion salt-run salt-ssh salt-syndic

13,启动salt各个模块

可以使用salt-minion –d 方式启动

 

posted @ 2017-12-15 11:17  snailshadow  阅读(448)  评论(0编辑  收藏  举报