码迷,mamicode.com
首页 > 其他好文 > 详细

SaltStack的批量安装步骤

时间:2018-08-02 11:28:30      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:部署   scp   env   依赖库   pen   报错   解压   2.7   5.0   

1、首先制作SaltStack的安装包  

(1)准备安装SaltStack模板的安装包和rpm包

通过tar -zxvf *.tar.gz 命令解压后部署在/home/zabbix的目录下

rpm的安装包文件

uuid-c++-devel-1.6.1-10.el6.x86_64.rpm

uuid-c++-1.6.1-10.el6.x86_64.rpm

uuid-1.6.1-10.el6.x86_64.rpm

uuid-devel-1.6.1-10.el6.x86_64.rpm

uuidd-2.17.2-12.14.el6.x86_64.rpm

安装saltstack模块的子目录

PyYAML-3.11

setuptools-7.0

Jinja2-2.7.3

MarkupSafe-0.9.3

pyzmq-14.4.1

M2Crypto-0.22.3

msgpack-python-0.4.2

msgpack-pure-0.1.3

requests-2.5.0

salt-2014.7.0

pycrypto-2.6.1

yaml-0.1.5

autoconf-2.69

libsodium-1.0.1

zeromq-4.0.5

openssl-1.0.1g

Python-2.7.8

libnacl-1.3.5

ioflo-1.0.2

six-1.8.0

raet-0.4.2

Mako-1.0.0  

(2)python 2.7安装在指定的/usr/local/SaltStack/Python-2.7.8目录下面

# cd /home/zabbix/Python-2.7.8                                   

# ./configure --prefix=/usr/local/SaltStack/Python-2.7.8                   

# make && make install 

export _PYTHON=/usr/local/SaltStack/Python-2.7.8/bin/python


然后按照后面的顺序安装python的模块,安装之前编辑模板安装配置文件setup.py ,修改pthon的路径,

在setup.py的文件第一行设置pthon的路径,替换原来的路径

#!/usr/local/SaltStack/Python-2.7.8/bin/python

#/usr/bin/env python


以避免编译saltstack时,找不到所需的lib库文件  


修改/etc/ld.so.conf文件包括以下内容:

include ld.so.conf.d/*.conf

/usr/local/lib

/usr/local/lib64

/usr/local/SaltStack/Python-2.7.8/lib

/sbin/ldconfig 重新装载

避免报错找不到lib或者lib.so的库文件,例如:

  File "/usr/local/SaltStack/Python-2.7.8/lib/python2.7/site-packages/libnacl/__init__.py", line 62, in _get_nacl

    raise OSError(msg)

OSError: Could not locate nacl lib, searched for libsodium.so, libsodium.so.X (for X <= 100), and tweetnacl.so


(3)PyYAML模块安装   

# cd /home/zabbix/yaml-0.1.5                                     

# ./configure --prefix=/usr/local/SaltStack/Python-2.7.8                  

# make && make install       

# cd PyYAML-3.11                                          

# $_PYTHON setup.py install    


(4)setuptools模块安装                                                   

# cd /home/zabbix/setuptools-7.0                                                       

# $_PYTHON setup.py install          


(5)markupsafe模块安装

# cd /home/zabbix/MarkupSafe-0.9.3

# $_PYTHON setup.py install



(6)jinja2模块安装

# cd /home/zabbix/Jinja2-2.7.3

# $_PYTHON setup.py install


(7)msgpack模块安装

# cd /home/zabbix/msgpack-python-0.4.2

# $_PYTHON setup.py install



(8)pycrypto模块安装

# cd /home/zabbix/pycrypto-2.6.1

# $_PYTHON setup.py install


(9)pyzmq模块安装

# cd /home/zabbix/autoconf-2.69

# ./configure --prefix=/usr/local/SaltStack/Python-2.7.8

# make && make install


## 其他依赖库安装

# yum -y install libuuid.x86_64 libuuid-devel.x86_64

# yum -y install uuid.x86_64 uuid-devel.x86_64

# yum -y install uuid-c++.x86_64 uuid-c++-devel.x86_64


# cd /home/zabbix/zeromq-4.0.5

# ./autogen.sh

# ./configure --prefix=/usr/local/SaltStack/Python-2.7.8

# make && make install


# cd /home/zabbix/libsodium-1.0.1

# ./autogen.sh

# ./configure --prefix=/usr/local/SaltStack/Python-2.7.8

# make && make install


# cd /home/zabbix/pyzmq-14.4.1

# $_PYTHON setup.py configure --zmq=/usr/local/SaltStack/Python-2.7.8

# $_PYTHON setup.py install


(10)M2Crypto模块安装

# yum -y install swig.x86_64


# cd /home/zabbix/openssl-1.0.1g

# ./config shared --prefix=/usr/local/SaltStack/Python-2.7.8

# make && make install


# cd /home/zabbix/M2Crypto-0.22.3

# $_PYTHON setup.py install 


(11)libnacl-1.3.5模块安装

# cd /home/zabbix/libnacl-1.3.5

# $_PYTHON setup.py install 

(12)ioflo-1.0.2模块安装

# cd /home/zabbix/ioflo-1.0.2

# $_PYTHON setup.py install 

(13)M2Crypto-0.22.3模块安装

# cd /home/zabbix/M2Crypto-0.22.3

# $_PYTHON setup.py install 

(14)raet-0.4.2模块安装

# cd /home/zabbix/raet-0.4.2

# $_PYTHON setup.py install 

(15)Mako-1.0.0模块安装

# cd /home/zabbix/Mako-1.0.0

# $_PYTHON setup.py install 

  

(16)saltstack安装

# cd /home/zabbix/salt-2014.7.0

# $_PYTHON setup.py install

验证安装模板是否成功 

# /usr/local/SaltStack/Python-2.7.8/bin/salt --versions-report

           Salt: 2014.7.0

         Python: 2.7.8 (default, Aug  1 2018, 16:05:24)

         Jinja2: 2.7.3

       M2Crypto: 0.22

 msgpack-python: 0.4.2

   msgpack-pure: 0.1.3

       pycrypto: 2.6.1

        libnacl: 1.3.5

         PyYAML: 3.11

          ioflo: 1.0.2

          PyZMQ: 14.4.1

           RAET: 0.4.2

            ZMQ: 4.0.5

           Mako: 1.0.0


2、在其他机器上部署saltstack

(1)打包所有的安装模板

cd /usr/local/SaltStack/Python-2.7.8

tar cvf /tmp/saltPython.tar .    

ls -l /tmp/saltPython.tar

-rw-r--r-- 1 root root  160092160 Aug  2 09:22 /tmp/saltPython.tar    

(2)在远程的主机上创建zabbix用户组和用户

因为我是要安装zabbix的客户端,所以就创建了一个zabbix用户和用户组。

groupadd zabbix

useradd -g zabbix zabbix

(3)saltPython.tar传到远程部署saltstack

scp /tmp/saltPython.tar XXX.XXX.XXX.XXX:/home/zabbix        

mkdir -p  /usr/local/SaltStack/Python-2.7.8

cd  /usr/local/SaltStack/Python-2.7.8

tar xvf  /home/zabbix/saltPython.tar    


修改/etc/ld.so.conf文件包括以下内容:

include ld.so.conf.d/*.conf

/usr/local/lib

/usr/local/lib64

/usr/local/SaltStack/Python-2.7.8/lib

/sbin/ldconfig 重新装载

避免报错找不到lib或者lib.so的库文件,例如:

  File "/usr/local/SaltStack/Python-2.7.8/lib/python2.7/site-packages/libnacl/__init__.py", line 62, in _get_nacl

    raise OSError(msg)

OSError: Could not locate nacl lib, searched for libsodium.so, libsodium.so.X (for X <= 100), and tweetnacl.so


验证安装模板是否成功 

# /usr/local/SaltStack/Python-2.7.8/bin/salt --versions-report

           Salt: 2014.7.0

         Python: 2.7.8 (default, Aug  1 2018, 16:05:24)

         Jinja2: 2.7.3

       M2Crypto: 0.22

 msgpack-python: 0.4.2

   msgpack-pure: 0.1.3

       pycrypto: 2.6.1

        libnacl: 1.3.5

         PyYAML: 3.11

          ioflo: 1.0.2

          PyZMQ: 14.4.1

           RAET: 0.4.2

            ZMQ: 4.0.5

           Mako: 1.0.0    

           

           


SaltStack的批量安装步骤

标签:部署   scp   env   依赖库   pen   报错   解压   2.7   5.0   

原文地址:http://blog.51cto.com/11991464/2153488

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!