阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

源码安装SaltStack时遇到问题及解决

126次阅读
没有评论

共计 3662 个字符,预计需要花费 10 分钟才能阅读完成。

公司的系统都是内网,无法连接互联网,所以没办法只有源码安装了。

看了下 saltstack 的官网,需要安装的包有

https://docs.saltstack.com/en/latest/topics/installation/index.html

DEPENDENCIES

Salt should run on any Unix-like platform so long as the dependencies are met.

  • Python 2.6 >= 2.6 <3.0
  • msgpack-python – High-performance message interchange format
  • YAML – Python YAML bindings
  • Jinja2 – parsing Salt States (configurable in the master settings)
  • MarkupSafe – Implements a XML/HTML/XHTML Markup safe string for Python
  • apache-libcloud – Python lib for interacting with many of the popular cloud service providers using a unified API
  • Requests – HTTP library

Depending on the chosen Salt transport, ZeroMQ or RAET, dependencies vary:

  • ZeroMQ:
    • ZeroMQ >= 3.2.0
    • pyzmq >= 2.2.0 – ZeroMQ Python bindings
    • PyCrypto – The Python cryptography toolkit
    • M2Crypto – “Me Too Crypto” – Python OpenSSL wrapper
  • RAET:
    • libnacl – Python bindings to libsodium
    • ioflo – The flo programming interface raet and salt-raet is built on
    • RAET – The worlds most awesome UDP protocol

Salt defaults to the ZeroMQ transport, and the choice can be made at install time, for example:

python setup.py --salt-transport=raet install


一般都使用 zeromq, 其余的包安装都很顺利,没遇到什么问题,安装 zeroMQ 的时候遇到不少问题,查了好多资料,这里记录下,免得以后又忘记了
1. 安装 pyzmq 的时候报错
python setup.py install
最后报错

gcc: error trying to exec ‘cc1plus’: execvp: 没有那个文件或目录

error: command ‘gcc’ failed with exit status 1

查询很多网址后发现说明是 gcc 和 g ++ 版本不一致导致的问题,一查,发现操作系统根本就没安装 g ++,安装个 g ++ 后重新安装正常

2. 安装 M2Crypto 时报错

building ‘M2Crypto.__m2crypto’ extension

swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c

swig -python -I/usr/include/python2.7 -I/usr/include -I/usr/include/openssl -includeall -modern -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i

unable to execute swig: No such file or directory

error: command ‘swig’ failed with exit status 1

发现安装 m2crypto 需要用到 swig,而本机上没有安装 swig,所以报错,就需要安装 swig,此处又给后面挖了一个坑

在 swig 的主页上下载了最新版的 swig 3.0.7

安装完 swig 后继续安装 M2Crypto,继续报错

Running setup.py install for M2Crypto
    building 'M2Crypto.__m2crypto' extension
    swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
    swig -python -I/usr/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
    /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.
    error: command 'swig' failed with exit status 1

根据这个报错提示结合搜索到的结果,在 M2Crypto 目录的 setup.py 中加上一句

self.swig_opts.append(‘-cpperraswarn’)

 重新安装没有报错

其余的包安装都很顺利,没有报错

本以为安装好了,执行 salt-master,这次没有报什么什么库找不到了,又报了一个新的错误

[ERROR] ‘module’ object has no attribute ‘PKCS5_SALT_LEN’

Traceback (most recent call last):

  File “/usr/lib/python2.7/site-packages/salt/utils/parsers.py”, line 155, in parse_args

    process_option_func()

  File “/usr/lib/python2.7/site-packages/salt/utils/parsers.py”, line 435, in process_config_dir

    self.config.update(self.setup_config())

  File “/usr/lib/python2.7/site-packages/salt/utils/parsers.py”, line 1411, in setup_config

    return config.master_config(self.get_config_file_path())

  File “/usr/lib/python2.7/site-packages/salt/config.py”, line 2052, in master_config

    opts = apply_master_config(overrides, defaults)

  File “/usr/lib/python2.7/site-packages/salt/config.py”, line 2069, in apply_master_config

    import salt.crypt

  File “/usr/lib/python2.7/site-packages/salt/crypt.py”, line 21, in <module>

    from M2Crypto import RSA, EVP

  File “build/bdist.linux-x86_64/egg/M2Crypto/__init__.py”, line 24, in <module>

  File “build/bdist.linux-x86_64/egg/M2Crypto/ASN1.py”, line 12, in <module>

  File “build/bdist.linux-x86_64/egg/M2Crypto/BIO.py”, line 221, in <module>

  File “build/bdist.linux-x86_64/egg/M2Crypto/BIO.py”, line 227, in CipherStream

AttributeError: ‘module’ object has no attribute ‘PKCS5_SALT_LEN’

 又只有继续搜索,找了很长时间才发现说是 swig 新版本的一个 bug,回退到 3.0.4 即可解决该问题,又重新下载 swig 3.0.4 安装,再重新安装 M2Crypto,saltstack 终于安装完成,源码安装真是痛苦,好在现在都是虚拟机,安装好一个制作好模板,以后使用就不成问题了。

欢迎交流 salt-stack 的各种问题

SaltStack 安装和测试  http://www.linuxidc.com/Linux/2015-10/123769.htm

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-12/126517.htm

正文完
星哥说事-微信公众号
post-qrcode
 
星锅
版权声明:本站原创文章,由 星锅 2022-01-21发表,共计3662字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中