1. 程式人生 > >SaltStack的批量安裝步驟

SaltStack的批量安裝步驟

.py 其他 dir version zab default openssl clu 包括

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的批量安裝步驟