安装 ansible

1、Linux 替换 pip 默认镜像源:

cd ~/
mkdir .pip
vim pip.conf
# pip.conf

# 加入
[global]
timeout = 10 # 设置超时,单位s
index-url =  http://mirrors.aliyun.com/pypi/simple/   # 指定优先下载源
extra-index-url= http://pypi.douban.com/simple/   # 第二下载源
[install]
trusted-host=   mirrors.aliyun.com # 可能需要使用https方式通信

2、安装 ansible

pip install ansible-2.3.3.3.0.tar.gz

3、安装 ansible 报错缺少 pycrypto 模块
解决办法:

pip install pycrypto-2.6.1.tar.gz
# tar 安装
# 参考 : https://jingyan.baidu.com/article/19020a0a45c3a2529c284263.html
解压tar,进入解压目录,运行 cd ansible.../
python setup.py build | more # 程序开始自动编译ansible模块
python setup.py install | more # 编译完毕后,执行安装命令
安装完成以后,我们就可以直接调用ansible命令了
ansible --version # 查看版本信息

4、安装python模块pycrypto报错 error: command 'gcc' failed with exit status 1
解决办法:
明明装了gcc的,怎么会不行呢,然后发觉是failed不是not found,这说明这个错误个gcc没多大关系,应该是缺少某些功能模块。

yum install gcc libffi-devel python-devel openssl-devel

*仅做学习记录

你可能感兴趣的:(安装 ansible)