Ansible 安装

本文详细介绍了在Centos7系统环境下,通过源码包安装Ansible的过程,包括下载、解压、安装及解决安装过程中遇到的问题,如Python依赖库的安装和cffi版本冲突等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

系统环境:Centos7

这里使用源码包安装,因为centos7默认已经安装了python2.7,所以这里就不用安装了,否则需要安装python2.7或者以上版本。当然,最简单的还是yum安装:yum install ansible -y

1、下载ansible源码包

#cd /data
# wget https://releases.ansible.com/ansible/ansible-2.7.5.tar.gz
或者进入到下面这个网页自行下载需要的软件包版本
https://releases.ansible.com/ansible/

2、解压

# tar zxvf ansible-2.7.5.tar.gz

3、安装

# cd ansible-2.7.5/
# python2.7 setup.py install

安装过程中报错如下:

(1)、ext/_yaml.c:4:20: fatal error: Python.h: No such file or directory   提示缺少文件,所以需要安装python-devel库

# yum install python-devel -y

(2)、error: Installed distribution cffi 0.8.6 conflicts with requirement cffi>=1.4.1 提示cffi版本太低,下载cffi

# wget https://files.pythonhosted.org/packages/e7/a7/4cd50e57cc6f436f1cc3a7e8fa700ff9b8b4d471620629074913e3735fb2/cffi-1.11.5.tar.gz
或者进入下面的网页自行下载需要的软件包版本
https://pypi.python.org/pypi/cffi/
# tar zxvf cffi-1.11.5.tar.gz
# cd cffi-1.11.5/
# python2 setup.py  build 执行这一步的时候为了检查是否报错,当然,这里报错了。提示错误 fatal error: ffi.h: No such file or directory,所以安装依赖的库
# yum install libffi-devel -y

4、继续安装

# python2.7 setup.py install

如果安装过程中缺少什么就安装什么就行了

5、安装完检查版本

[root@runstone ansible-2.7.5]# ansible --version
ansible 2.7.5
  config file = None
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible-2.7.5-py2.7.egg/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

 

 

ansible配置文件详解借鉴:https://www.cnblogs.com/LuisYang/p/5960660.html

转载于:https://www.cnblogs.com/yjt1993/p/10131066.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值