
Installing on Linux
There are a few different ways of installing Ansible on Ubuntu 18.04. However, I am only going to cover one of them here. While there are packages available for Ubuntu from which you can install with apt, they tend to quickly become out of date and are typically behind the current release.
Advanced Packaging Tool (APT) is the package manager that ships with Debian-based systems, including Ubuntu. It is used to manage .deb files.
Because of this, we will be using pip. The first thing to do is install pip, and this can be done by running the following command:
$ sudo -H apt-get install python-pip
Once pip is installed, the instructions for installing Ansible are the same as installing on macOS. Simply run the following command:
$ sudo -H pip install ansible
This will download and then install Ansible and its requirements, as shown in the following screenshot:

Once installed, you can upgrade it by using the following command:
$ sudo -H pip install ansible --upgrade
Note that this time, we do not have to ignore anything as there shouldn't be any problems with the default installation. Also, downgrading Ansible is the same command:
$ sudo -H pip install ansible==2.3.1.0 --ignore-installed setuptools
The preceding commands should work on most Linux distributions, such as CentOS, Red Hat Enterprise Linux, Debian, and, Linux Mint.