centos6.x中安裝ansible
阿新 • • 發佈:2018-12-01
在centos6.x的環境中安裝ansible
方法一:
直接yum安裝,安裝前要配置yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
yum clean all
yum makecache
yum install epel-release
yum repolist
yum install ansible
方法二:
升級python至2.7版本,再安裝pip後,通過pip安裝ansible,命令如下:
wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz tar zxvf Python-2.7.14.tgz cd Python-2.7.14 ./configure make && make install
mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
whereis pip
ln -s /usr/local/bin/pip2.7 /usr/bin/pip
pip install paramiko PyYAML Jinja2 httplib2 six pip install ansible pip install ansible==2.2 #安裝ansible指定版本號2.2
centos6.x的python預設是2.6,需要修改yum檔案,否則yum可能不可用。
編輯/usr/bin/yum檔案
第一行:
#!/usr/bin/python 改成 #!/usr/bin/python2.6
ansible安裝完成以後記得配置檔案:
/etc/ansible/ansible.cfg
如果執行ansible出現"Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability"的提示。
參考https://blog.csdn.net/vbaspdelphi/article/details/53170575