Install Ansible on Ubuntu

Learn how to install Ansible in the Linux Ubuntu distribution using APT.

Installing Ansible in Ubuntu is easy because the package is in the system repository. We can apply the same steps in any Linux distribution based on the DEB package format managed by the APT package manager (Debian, Ubuntu, Linux Mint, MX Linux, Deepin, AntiX, PureOS, Kali Linux, Parrot OS, Devuan, Knoppix, AV Linux). We make sure to execute our commands as root user or use the sudo command for privilege escalation.

Installation options

We can install Ansible in Ubuntu in two ways:

  • The Universe repository
  • Personal Package Archives (PPA)

Both methods enable us to install and maintain up-to-date Ansible using the APT package manager in our Ubuntu Linux distribution.

We can test if Ansible is installed in our system using the following command:

ansible --version

When the ansible package is not installed in our system, we receive the following error:

command not found: ansible

We can install Ansible in Ubuntu Linux using the Universe repository and PPA repositories.

The Universe repository

The first and easiest way to install and maintain Ansible inside Ubuntu Linux is with the Universe repository. The Universe repository is the default repository enabled after installing Ubuntu on our system. The main advantage of using the Universe repository is that we don’t require any external repository.

Get hands-on with 1400+ tech skills courses.