Install Ansible on Linux and MacOS

by Daniel Pham
Published: Updated:

In this article, I will guide you to install Ansible on Linux and MacOS. Note that you can absolutely install Ansible on a Linux server to use. However, since you are in the learning process, you can install it on your personal computer.

Install Ansible on Linux

Ansible’s only software dependency is Python. The Linux operating system already supports Python, so you won’t need to do anything with it.

Install Ansible on Red Hat/Fedora/CentOS machine

For machines using the Fedora operating system, Ansible is already supported in the repository. You just need to run the command below to install it.

yum -y install ansible

As for machines using Red Hat or CentOS, you need to install EPEL’s RPM before installing Ansible. You use the command below to install EPEL’s RPM.

yum -y install epel-release

Then you execute the command to install Ansible as for Fedora.

Install Ansible on Debian/Ubuntu machine

For Debian or Ubuntu base servers, you can simply install Ansible via apt.

You use the commands below to install it.

sudo apt-get install -y python-software-properties
sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible

After the installation is complete, you can type the following command to test.

ansible --version

Kết quả sẽ tương tự như hình dưới. Tại thời điểm của bài viết này, phiên bản mới nhất của Ansible là 2.9.24.

Install Ansible on Linux and MacOS
Install Ansible on Linux.

Install Ansible on MacOS

With MacOS, the default operating system also supports Python2. You can check through the following command.

python --version

In case you want to use Python3 instead of Python2. You can install Python3 via the following command.

brew install python3

After installing Python3, check the version information.

python3 --version

So you’re done with Python. Now to install Ansible, you will have 2 ways.

  • First way: use pip.
pip install ansible

If your device does not have pip installed, you can install it with the command below.

sudo easy_install pip
  • Second way: use Homebrew.
brew install ansible

After installation is complete, you also check the Ansible version as in the Linux section.


Through this article, I have shown you how to install Ansible on Linux and MacOS personal computers. As for Windows computers, I will have a separate article next.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 – All rights reserved.

Please write sources “” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.