您的位置:首页 > 其它

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

2017-11-22 10:23 369 查看
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
<
4000
div style="line-height:1.75;">ImportError: No module named jinja2
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐