Ansible installation on CentOS 7 Linux



The following guide describes simple to follow steps on how to install the open-source automation engine Ansible on CentOS Linux.

Operating System and Software Versions

  • Operating System: – CentOS 7 Linux
  • Software: – Ansible 2.2 ( EPEL ) & Ansible 2.4 ( Source )


Privileged access to your CentOS Linux system will be required to perform the Ansible installation.




  • # – requires given command to be executed with root privileges either directly as a root user or by use of sudocommand
  • $ – given command to be executed as a regular non-privileged user


Installation from EPEL repository

The easiest way to perform the Ansible installation on CentOS Linux is by using standard package repository and EPEL repository. The disadvantage is that most likely you will install outdated but stable Ansible version. First install enable EPEL repository by install the following package:

# yum install epel-release

Next, install ansible:

# yum install ansible

If installed correctly you should be able to use the ansible command to query its version number:

$ ansible --version
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

Installation from Source

The following paragraph describes the Ansible installation from source. Let’s start by installation of all required prerequisites to perform Ansible compilation:

# yum install make git make gcc python-devel libffi-devel openssl-devel epel-release python-sphinx

Next, install python package manager:

# yum install python-pip 

At this stage we are ready to download the Ansible source code using git command:

$ git clone git://
$ cd ansible

Optionally, selected your desired Ansible version using git checkout command. If no Ansible version is selected, you will be installing the latest Ansible version available. While in ansible directory, first list all available stable versions:

 $ git branch -a | grep stable

Select desired version eg.:

$ git checkout stable-2.3

If all went well, now we are ready to perform the Ansible compilation and installation:

NOTE: Most likely the below compilation will be interrupted due to the outdated setuptools and pip versions. Refer to the appendix below on how to resolve this issues.

$ make
# make install

Test ansible installation by retrieving its version number:

$ ansible --version
ansible 2.4.0
  config file = 
  configured module search path = Default w/o overrides
  python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.