SaltStack(一)-- SaltStack介绍及CentOS 6.7安装SaltStack

一、SaltStack介绍

SaltStack是一个开源Apache 2.0 license的基于Python开发的配置管理系统及分布式远程执行工具。

Salt有local、Master/Minion、Salt SSH三种工作模式可以适用不同的使用环境。通常采用master/minion模式这种模式扩展方便部署灵活支持单IDC部署及跨IDC部署单个Master最好管理小于1000台minion可以采用Sydnic进行扩展。

Salt采用ZeroMQ保证命令发送到远程系统是并行而非串行。使用公钥和Master进行认证使用AES加密通信流量Salt中加密和认证机制是必不可少的通信更加安全。使用msgpack进行通信具有更高的效率产生更少的网络流量。

Salt可以稳定的运行在RHEL/CentOS/Ubuntu/FreeBSD/Oracle Linux/Amazon Linux等系统上。另外windows不支持salt master但是支持salt minion的安装及运行。

本文在CentOS  6.7  2.6.32-573.el6.x86_64下安装及测试。Salt版本为2015.5.5 (Lithium)。另安装可以参考官网链接https://docs.saltstack.com/en/latest/topics/installation/index.html

二、SaltStack安装

1、公共仓库安装(SaltStack 2015.5.5)

1)说明

从0.9.4版本开始支持EPEL源安装

官方文档说使用EPEL仓库安装会有各种依赖问题需要解决目前使用阿里云的yum仓库安装没有出现问题。

官方文档提到的问题主要有

a最新版的SaltStack不会及时在EPEL中更新

bpython-jinja2从EPEL移至"RHEL Server Optional Channel"

cSaltStack 2015.8需要python-crypto(2.6.1及以上)和python-tornado4.2.1及以上但是Redhat5和6的EPEL中没有

4、需要启用EPEL仓库

2)使用yum安装master

[[email protected] yum.repos.d]# yum install -y salt-master
已加载插件fastestmirror, security
设置安装进程
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                             | 3.7 kB     00:00     
epel                                                                                                                                                             | 4.3 kB     00:00     
extras                                                                                                                                                           | 3.4 kB     00:00     
updates                                                                                                                                                          | 3.4 kB     00:00     
解决依赖关系
--> 执行事务检查
.......

依赖关系解决

========================================================================================================================================================================================
 软件包                                                        架构                             版本                                             仓库                              大小
========================================================================================================================================================================================
正在安装:
 salt-master                                                   noarch                           2015.5.5-1.el6                                   epel                             989 k
为依赖而安装:
 PyYAML                                                        x86_64                           3.10-3.1.el6                                     base                             157 k
 libyaml                                                       x86_64                           0.1.3-4.el6_6                                    base                              52 k
 m2crypto                                                      x86_64                           0.20.2-9.el6                                     base                             471 k
 openpgm                                                       x86_64                           5.1.118-3.el6                                    epel                             165 k
 python-babel                                                  noarch                           0.9.4-5.1.el6                                    base                             1.4 M
 python-backports                                              x86_64                           1.0-5.el6                                        base                             5.5 k
 python-backports-ssl_match_hostname                           noarch                           3.4.0.2-4.el6.centos                             extras                            13 k
 python-chardet                                                noarch                           2.2.1-1.el6                                      base                             230 k
 python-jinja2                                                 x86_64                           2.2.1-2.el6_5                                    base                             466 k
 python-msgpack                                                x86_64                           0.4.6-1.el6                                      epel                              69 k
 python-requests                                               noarch                           2.6.0-3.el6                                      base                              95 k
 python-six                                                    noarch                           1.9.0-2.el6                                      base                              28 k
 python-urllib3                                                noarch                           1.10.2-1.el6                                     base                             101 k
 python-zmq                                                    x86_64                           14.3.1-1.el6                                     epel                             467 k
 salt                                                          noarch                           2015.5.5-1.el6                                   epel                             4.2 M
 zeromq3                                                       x86_64                           3.2.5-1.el6                                      epel                             338 k

事务概要
========================================================================================================================================================================================
Install      17 Package(s)

3)使用yum安装minion

[[email protected] yum.repos.d]# yum install -y salt-minion
......

4)设置开机启动及运行

#设置开机启动
[[email protected] yum.repos.d]# chkconfig --level 2345 salt-master on
[[email protected] yum.repos.d]# chkconfig --level 2345 salt-minion on

#检查设置
[[email protected] yum.repos.d]# chkconfig --list |grep salt
salt-master     0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭
salt-minion     0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

#启动master
[[email protected] yum.repos.d]# /etc/init.d/salt-master start
Starting salt-master daemon:                               [确定]

#启动minion
[[email protected] yum.repos.d]# /etc/init.d/salt-minion start
Starting salt-minion daemon:                               [确定]

2、SaltStack仓库安装(官方推荐可惜仓库访问不了大家都懂的.....SaltStack 2015.8.1)

从2015.8.0版本后Salt在RHEL5、6、7上的安装可以使用SaltStack仓库。

1)下载并安装SaltStack仓库的公钥并导入

#下载公钥
[[email protected] ~]# wget https://repo.saltstack.com/yum/rhel6/SALTSTACK-GPG-KEY.pub   
--2015-11-15 21:28:00--  https://repo.saltstack.com/yum/rhel6/SALTSTACK-GPG-KEY.pub
正在解析主机 repo.saltstack.com... 198.199.77.106
正在连接 repo.saltstack.com|198.199.77.106|:443... 已连接。
已发出 HTTP 请求正在等待回应... 200 OK
长度1744 (1.7K)
正在保存至: “SALTSTACK-GPG-KEY.pub”
100%[==================================================================================================================>] 1,744       --.-K/s   in 0s      
2015-11-15 21:28:12 (244 MB/s) - 已保存 “SALTSTACK-GPG-KEY.pub” [1744/1744])

[[email protected] ~]# rpm --import SALTSTACK-GPG-KEY.pub 

#查看本机安装的公钥
[[email protected] ~]# rpm -qa gpg-pubkey*   
gpg-pubkey-de57bfbe-53a9be98
gpg-pubkey-c105b9de-4e0fd3a3

#查看公钥信息
[[email protected] ~]# rpm -qi gpg-pubkey-de57bfbe-53a9be98    
Name        : gpg-pubkey                   Relocations: (not relocatable)
Version     : de57bfbe                          Vendor: (none)
Release     : 53a9be98                      Build Date: 2015年11月15日 星期日 21时29分18秒
Install Date: 2015年11月15日 星期日 21时29分18秒      Build Host: localhost
Group       : Public Keys                   Source RPM: (none)
Size        : 0                                License: pubkey
Signature   : (none)
Summary     : gpg(SaltStack Packaging Team <[email protected]>)
Description :
-----BEGIN PGP PUBLIC KEY BLOCK-----

#删除公钥
[[email protected] ~]# rm -f SALTSTACK-GPG-KEY.pub

2)编辑SaltStack yum仓库配置文件/etc/yum.repos.d/saltstack.repo添加如下信息

[[email protected] ~]# vim /etc/yum.repos.d/saltstack.repo
####################
# Enable SaltStack‘s package repository
[saltstack-repo]
name=SaltStack repo for RHEL/CentOS 6
baseurl=https://repo.saltstack.com/yum/rhel6
enabled=1
gpgcheck=1
gpgkey=https://repo.saltstack.com/yum/rhel6/SALTSTACK-GPG-KEY.pub

3运行yum clean expire-cache刷新yum仓库缓存

[[email protected] ~]# yum clean expire-cache
已加载插件fastestmirror, security
Cleaning repos: base epel extras saltstack-repo updates

4)在需要安装master的机器安装master

[[email protected] ~]# yum install -y salt-master
已加载插件fastestmirror, security
设置安装进程
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
解决依赖关系
--> 执行事务检查
---> Package salt-master.noarch 0:2015.8.1-1.el6 will be 安装
--> 处理依赖关系 salt = 2015.8.1-1.el6它被软件包 salt-master-2015.8.1-1.el6.noarch 需要
--> 执行事务检查
..............
--> 完成依赖关系计算
依赖关系解决
========================================================================================================================================================================================
 软件包                                                      架构                           版本                                           仓库                                    大小
========================================================================================================================================================================================
正在安装:
 salt-master                                                 noarch                         2015.8.1-1.el6                                 saltstack-repo                         1.2 M
为依赖而安装:
 PyYAML                                                      x86_64                         3.11-1.el6                                     saltstack-repo                         152 k
 libyaml                                                     x86_64                         0.1.3-4.el6_6                                  base                                    52 k
 python-babel                                                noarch                         0.9.4-5.1.el6                                  base                                   1.4 M
 python-backports                                            x86_64                         1.0-5.el6                                      base                                   5.5 k
 python-backports-ssl_match_hostname                         noarch                         3.4.0.2-4.el6.centos                           extras                                  13 k
 python-chardet                                              noarch                         2.2.1-1.el6                                    base                                   230 k
 python-futures                                              noarch                         3.0.3-1.el6                                    saltstack-repo                          26 k
 python-jinja2                                               x86_64                         2.2.1-2.el6_5                                  base                                   466 k
 python-markupsafe                                           x86_64                         0.11-10.el6                                    saltstack-repo                          24 k
 python-msgpack                                              x86_64                         0.4.6-1.el6                                    epel                                    69 k
 python-requests                                             noarch                         2.6.0-3.el6                                    base                                    95 k
 python-six                                                  noarch                         1.9.0-2.el6                                    base                                    28 k
 python-tornado                                              x86_64                         4.2.1-1.el6                                    saltstack-repo                         661 k
 python-urllib3                                              noarch                         1.10.2-1.el6                                   base                                   101 k
 python-zmq                                                  x86_64                         14.5.0-2.el6                                   saltstack-repo                         479 k
 salt                                                        noarch                         2015.8.1-1.el6                                 saltstack-repo                         5.1 M
 zeromq                                                      x86_64                         4.0.5-1.el6                                    saltstack-repo                         568 k
 python-crypto                                               x86_64                         2.6.1-2.el6                                    saltstack-repo                         501 k
事务概要
========================================================================================================================================================================================
Install      18 Package(s)

5)在需要安装minion的机器安装minion

[[email protected] ~]# yum install salt-minion
.......

6)设置开机启动及运行

#设置开机启动
[[email protected] yum.repos.d]# chkconfig --level 2345 salt-master on
[[email protected] yum.repos.d]# chkconfig --level 2345 salt-minion on

#检查设置
[[email protected] yum.repos.d]# chkconfig --list |grep salt
salt-master     0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭
salt-minion     0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

#启动master
[[email protected] yum.repos.d]# /etc/init.d/salt-master start
Starting salt-master daemon:                               [确定]

#启动minion
[[email protected] yum.repos.d]# /etc/init.d/salt-minion start
Starting salt-minion daemon:                               [确定]

4、pip安装&源码安装

不推荐这两种方法安装并没有什么本质的提升而且安装麻烦


时间: 2024-10-09 07:15:43

SaltStack(一)-- SaltStack介绍及CentOS 6.7安装SaltStack的相关文章

Centos 6上安装Saltstack

[[email protected]_server home]# ifconfig eth0 | grep "inet addr:" | awk -F: '{print $2}' | awk '{print $1}'     192.168.100.228     [[email protected]_server home]# cat /etc/redhat-release      CentOS release 6.3 (Final)     [[email protected]_

CentOS 7.2 部署Saltstack

CentOS 7.2部署Saltstack 一.环境介绍: 服务器名称 IP地址 Salt-Master 192.168.30.141 Slave1 192.168.30.131 Slave2 192.168.30.132 二.部署前的准备: 1.添加host文件: 在Master上操作: # echo -e "192.168.30.141 Salt-Master\n192.168.30.131 Slave1\n192.168.30.132 Slave2" >> /etc/

CentOS 6.5下SaltStack部署记录

1. 安装第三方yum源 wget -c http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm 2. 服务端安装  yum install salt-master -y 3. 客户端安装  yum install salt-minion -y 4. master设置 salt-master默认配置文件/etc/salt/maste

Saltstack 基础详细介绍

1.saltstack 基础详细介绍  Saltstack使用Python开发,是一个非常简单易用和轻量级的管理工具.由Master和Minion构成,通过ZeroMQ进行通信    Saltstack的master端监听4505与4506端口,4505为salt的消息发布系统,4506为salt客户端与服务端通信的端口:salt客户端程序不监听端口,客户端启动后,会主动连接master端注册,然后一直保持该TCP连接,master通过这条TCP连接对客户端控制,如果连接断开,master对客户

centos 7.4 x86 安装saltstack

安装saltstack 基本是很简单的了.一直yum安装就好了,但是这次遇到了一些坑,记录一下,以后避免.环境: centos 7.4 x86 python2.7.5 主控端yum -y install salt-master一直安装就好了.如果提示没有包,下载一个saltstack源就好了.在主控端安装salt-api.如果一直yum安装,yum -y install salt-api因为salt-api是基于CherryPy框架开发的.它会安装一个python-cherrypy依赖包.安装完

SaltStack 入门到精通 - 第一篇: 安装SaltStack

实际环境的设定: 系统环境: centos6 或centos5 实验机器: 192.168.1.100 软件需求: salt 套件,及其需求环境 实验目的: 成功安装salt,并实现salt主从间通讯 特殊设置: 其它目的: 安装SaltStack(下面简称为salt) epel安装:salt安装需要epel源支持,所以在安装salt前需要先安装epel包 # centos5 下载下面rpm  wget -O    epel.rpm https://dl.fedoraproject.org/pu

初始saltstack在之CentOS6上安装Saltstack

系统环境: [[email protected]_server home]# ifconfig eth0 | grep "inet addr:" | awk -F: '{print $2}' | awk '{print $1}'     192.168.100.228     [[email protected]_server home]# cat /etc/redhat-release      CentOS release 6.3 (Final)     [[email prote

纪念第一次安装saltstack

2016-08-19 纪念第一次安装saltstack,因为走了好多弯路,必须记下来... 1.安装salt源 rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm 或 wget http://dl.cpis-opt.com/huanw/shencan/epel-release-5-4.noarch.rpm && rpm -vih epel-release-5-4.noarch.r

CentOS 6.5 安装部署iSCSi共享存储

 CentOS 6.5 安装部署iSCSi共享存储 一.前言 1.什么是iSCSI? iSCSI技术是一种由IBM公司研究开发的,是一个供硬件设备使用的可以在IP协议的上层运行的SCSI指令集,这种指令集合可以实现在IP网络上运行SCSI协议,使其能够在诸如高速千兆以太网上进行路由选择.iSCSI技术是一种新储存技术,该技术是将现有SCSI接口与以太网络(Ethernet)技术结合,使服务器可与使用IP网络的储存装置互相交换资料. iSCSI:Internet 小型计算机系统接口 (iSCSI: