Salt 安装
Ubuntu 14
导入仓库公钥用以校验完整性
wget -O - https://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
添加salt源进source.list
deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest trusty main
更新仓库
apt-get update
安装salt
apt-get install salt-api apt-get install salt-cloud apt-get install salt-master apt-get install salt-minion apt-get install salt-ssh apt-get install salt-syndic
CentOS yum安装
安装仓库
# yum -y install https://repo.saltstack.com/yum/redhat/salt-repo- latest-2.el6.noarch.rpm
清理缓存
yum clean all
安装salt和各组件
sudo yum install salt-master sudo yum install salt-minion sudo yum install salt-ssh sudo yum install salt-syndic sudo yum install salt-cloud sudo yum install salt-api
源码安装
没办法,Salt要求Python版本小于3.0,大于2.6,我这里系统默认是2.6,所以要先安装Python2.7
安装依赖包,编译工具等等,不一一列出,只记录和安装salt相关的
# yum -y install openssl-devel swig libtool
安装Python
# wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15rc1.tar.xz # tar xf Python-2.7.15rc1.tar.xz # cd Python-2.7.15rc1 # ./configure --prefix=/usr/local/python27 --with-ensurepip=install # make && make install
检查autoconf版本,需要>=autoconf-2.69,如果小于则升级
# curl -L -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz # tar xf autoconf-2.69.tar.gz # cd autoconf-2.69 # ./configure && make && make install # vim /etc/profile export PATH=usr/local/src/autoconf-2.69/bin:$PATH # source /etc/profile # autoconf -V
安装libzmq
# git clone git://github.com/zeromq/libzmq.git # cd libzmq # ./autogen.sh # ./configure # make && make install
安装PyYAML
# wget --no-check-certificate https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz#md5=74c94a383886519e9e7b3dd1ee540247 # tar xf PyYAML-3.10.tar.gz # cd PyYAML-3.10 # python2.7 setup.py install
安装MarkupSafe
# wget --no-check-certificate https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz # tar xf MarkupSafe-0.23.tar.gz # cd MarkupSafe-0.23 # python2.7 setup.py install
安装Jinjia2
# wget --no-check-certificate https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz # tar xf Jinja2-2.7.3.tar.gz # cd Jinja2-2.7.3 # python2.7 setup.py install
安装pyzmq
# wget --no-check-certificate https://pypi.python.org/packages/source/p/pyzmq/pyzmq-14.3.1.tar.gz#md5=7196b4a6fbf98022f17ffa924be3d68d # tar xf pyzmq-14.3.1.tar.gz # cd pyzmq-14.3.1 # python2.7 setup.py install
安装M2Crypto
# wget --no-check-certificate https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-0.29.0.tar.gz # tar xf M2Crypto-0.29.0.tar.gz # cd M2Crypto-0.29.0 # python2.7 setup.py install
安装msgpack-python
# wget --no-check-certificate https://pypi.python.org/packages/source/m/msgpack-python/msgpack-python-0.4.2.tar.gz # tar xf msgpack-python-0.4.2.tar.gz # cd msgpack-python-0.4.2 # python2.7 setup.py install
安装pycrypto
# wget --no-check-certificate https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz#md5=55a61a054aa66812daf5161a0d5d7eda # tar xf pycrypto-2.6.1.tar.gz # cd pycrypto-2.6.1 # python2.7 setup.py install
安装salt
# wget --no-check-certificate https://files.pythonhosted.org/packages/11/52/29a7b924e495f22764603aa095ab41b2c4a952a4b57ad5689dd863e575ff/salt-2018.3.0.tar.gz # tar xf salt-2018.3.0.tar.gz # cd salt-2018.3.0 # python2.7 setup.py install # mkdir /etc/salt && cp conf/master /etc/salt # cp conf/minion /etc/salt # egrep -v "#|^$" /etc/salt/minion master: 1.1.1.1
启动salt-minion,salt依赖tornado的一些模块,而且tornado版本>=4.2.1<5.0
# pip2.7 install tornado==4.2.1 # salt-minion
由于salt-minion常驻前台,所以安装supervisor作为salt-minion守护程序
# yum -y install supervisor # [program:salt-minion] command=/usr/local/python27/bin/salt-minion autostart=true autorestart=true logfile=/var/log/salt-minion.log # /etc/init.d/supervisord start # ps aux|grep salt root 19006 0.0 0.9 299064 37384 ? S 10:05 0:00 /usr/local/python27/bin/python2.7 /usr/local/python27/bin/salt-minion root 19015 0.0 1.1 624888 45392 ? Sl 10:05 0:01 /usr/local/python27/bin/python2.7 /usr/local/python27/bin/salt-minion root 19017 0.0 0.8 376684 33264 ? S 10:05 0:00 /usr/local/python27/bin/python2.7 /usr/local/python27/bin/salt-minion