步驟1:安裝python-pip及pythondevel程序包
shell> yum install python-pip python-devel -y
步驟2:安裝環(huán)境檢查
//確保服務器安裝了gcc glibc 等開發(fā)環(huán)境包
shell> yum install gcc glibc-devel zlib-devel rpm-build openssl-devel -y
//更新pip至最新版本
shell> pip install –upgrde pip
步驟3:安裝ansible
shell> pip install ansible –upgrade
步驟4:查看安裝的ansible版本
shell> ansible –version
ansible 2.7.10
注釋:centos7.5 這個方法不一定能安裝成功,因為python版本的問題,當你pip的時候,新版本的ansible會報錯python過低。
如果對系統(tǒng)python 版本升級,那你會碰到好多的問題,推薦2個工具大家可以了解下,Pyenv / Virtualenv 多python環(huán)境擴展管理工具。
二、yum 安裝
(1)添加yum源 選擇阿里epel源
shell> rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm centos7
shell> rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm centos6
(2) yum 安裝ansible
shell> yum -y install ansible
三、 apt-get 安裝
(1)添加ansible源
shell> apt-add-repository -y ppa:ansible/ansible
(2)安裝ansible
shell> apt-get update
shell> apt-get install -y ansible
更多關于云服務器,域名注冊,虛擬主機的問題,請訪問三五互聯(lián)官網:m.shinetop.cn