yum install ansible无法直接安装Ansible的解决方法

1、系统版本:

[root@www yum.repos.d]# uname -a

Linux www.zero04.com 2.6.39-400.17.1.el6uek.x86_64 #1 SMP Fri Feb 22 18:16:18 PST 2013 x86_64 x86_64 x86_64 GNU/Linux


2、直接yum install ansible后无效

[root@www /]# yum install ansible

Loaded plugins: security
Setting up Install Process
No package ansible available.
Error: Nothing to do

原因:Base yum源中没有ansible的安装包


3、更换为epel.repo yum 源

> 先将原有Base源备份

[root@www yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak

> 更换yum源

wget -O epel.repohttp://mirrors.aliyun.com/repo/epel-6.repo

> yum clean all

Loaded plugins: security
Cleaning repos: epel
Cleaning up Everything

> yum makecache

Loaded plugins: security
epel                                                                                                                                         | 4.7 kB     00:00     
epel/group_gz                                                                                                                                | 255 kB     00:00     
epel/filelists_db                                                                                                                            | 7.8 MB     00:14     
epel/updateinfo                                                                                                                              | 758 kB     00:01     
epel/prestodelta                                                                                                                             |  360 B     00:00     
epel/primary_db                                                                                                                              | 6.0 MB     00:10     
epel/other_db                                                                                                                                | 3.0 MB     00:05     
Metadata Cache Created

4、yum -y install ansible后仍然报错
--> Finished Dependency Resolution
Error: Package: python-jinja2-26-2.6-3.el6.noarch (epel)
           Requires: python-babel >= 0.8
Error: Package: python-keyczar-0.71c-1.el6.noarch (epel)
           Requires: python-pyasn1
Error: Package: python-jinja2-26-2.6-3.el6.noarch (epel)
           Requires: python-markupsafe
Error: Package: ansible-2.3.2.0-1.el6.noarch (epel)
           Requires: python-simplejson
Error: Package: ansible-2.3.2.0-1.el6.noarch (epel)
           Requires: PyYAML
Error: Package: ansible-2.3.2.0-1.el6.noarch (epel)
           Requires: python-six
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

原因:环境中没有python-simplejson python-babel PyYAML python-six python-pyasn1 python-markupsafe 这些包
解决方法:更换Base.repo yum源,执行
yum install python-simplejson python-babel PyYAML python-six python-pyasn1 python-markupsafe
注意:更换yum源要分别执行
a>yum clean all
b> yum makecache

5、[root@www yum.repos.d]# yum install python-simplejson python-babel PyYAML python-six python-pyasn1 python-markupsafe
Complete!

6、切换为epel yum源,再执行 yum -y install ansible
[root@www yum.repos.d]# yum -y install ansible
Complete!

7、查看ansible版本
[root@www yum.repos.d]# ansible --version
ansible 2.5.0
至此,Ansible 安装成功!

备注:如果在执行ansible --version过程中出现如下错误,直接yum intall python-jinja2 即可
Traceback (most recent call last):
File "/usr/bin/ansible", line 43, in <module>
import ansible.constants as C
File "/usr/lib/python2.6/site-packages/ansible-2.5.0-py2.6.egg/ansible/constants.py", line 11, in <module>
from jinja2 import Template
ImportError: No module named jinja2

  • 4
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值