Centos 7.2+Ubuntu 17.04安装ansible详解

时间:2024-04-06 20:47:07

二进制安装方式

Centos 7.2安装

一:PIP方式安装ansible
1.安装python-pip及python-devel程序包,yum -y install python-pip python-devel
2.安装开发环境gcc.glibc等,yum -y install gcc glibc-devel zlib-devel rpm-build openssl-devel
3.升级本地PIP到最新版本,pip install --upgrade pip
4.安装ansible服务,pip install ansible --upgrade
5.验证安装,ansible --version
二:YUM安装安装ansible
ansible被收录在epel源中,需要先安装epel源,如果之前安装过,也可以用第二条命令升级yum源
1.yum -y install epel-release
2.rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
3.安装ansibile,yum -y install ansible
4.验证安装,ansible --version

Ubuntu 17.04安装

一:apt-get方式安装
1.添加ansible源,apt-add-repository -y ppa:ansible/ansible(成功会有OK的提示)
2.升级库文件,apt-get update
3.安装ansibile,apt-get -y install ansible
4.验证安装,ansible --version

源码安装方式

Centos 7.2安装

1.安装git,yum -y install git
2.使用git拉取ansible软件包到当前目录,git clone git://github.com/ansible/ansible.git --recursive
3.切换至程序包目录,cd ./ansible
4.执行脚本安装ansible软件包,source ./hacking/env-setup(成功会有done提示)
Centos 7.2+Ubuntu 17.04安装ansible详解
5.验证安装,ansible --version

Ubuntu 17.04安装

安装方法同Centos大同小异,yum换成apt-get即可。

转载于:https://blog.51cto.com/12943999/2049660