Install Ansible: Complete Guide for Every OS (Ubuntu, RHEL, macOS, Windows, pip)
By Luca Berton · Published 2024-01-01 · Category: installation
How to install Ansible on every platform. Step-by-step instructions for Ubuntu, Debian, RHEL, CentOS, Fedora, macOS, Windows WSL, pip, pipx, and containers. Verify installation, configure SSH, and run your first playbook.
Install Ansible: Choose Your Method
Ansible runs on any Unix-like control node (Linux, macOS). Windows users run Ansible through WSL. Managed nodes need only SSH and Python — no agent installation required.
Quick Decision
| Your OS | Recommended Method | |---------|-------------------| | Ubuntu / Debian | pipx install ansible or apt install ansible | | RHEL / CentOS / Fedora | pipx install ansible or dnf install ansible-core | | macOS | pipx install ansible or brew install ansible | | Windows | Install WSL2 + Ubuntu, then pipx install ansible | | Container | quay.io/ansible/ansible-runner or custom EE | | CI/CD | pip install ansible-core in pipeline |
Best practice: Use pipx for the latest version with isolated dependencies. Package managers often ship older versions.
Install with pipx (Recommended — All Platforms)
Why pipx Over pip?
pipx installs Ansible in an isolated virtual environment, preventing conflicts with system Python packages. It also makes upgrades clean:
Install with pip
ansible vs ansible-core
| Package | Includes | Size | |---------|----------|------| | ansible | ansible-core + 100+ community collections | ~150 MB | | ansible-core | Core engine, ~70 builtin modules | ~15 MB |
Use ansible-core when you want to manage collections separately via ansible-galaxy.
Install on Ubuntu / Debian
From PPA (Latest)
From Default Repos
From pip on Ubuntu
Install on RHEL / CentOS / AlmaLinux / Rocky Linux
RHEL 9 / CentOS 9 Stream
RHEL 8 / CentOS 8 Stream
With AAP Subscription (RHEL)
Install on Fedora
Install on macOS
With Homebrew
With pipx
With pip
Install on Windows (WSL)
Ansible doesn't run natively on Windows. Use Windows Subsystem for Linux:
Manage Windows Hosts FROM Ansible
Ansible can manage Windows machines — you just can't run the Ansible control node on Windows. Install pywinrm to manage Windows targets:
Install in Containers
Docker / Podman
Execution Environments (EE)
For AAP and ansible-navigator, use Execution Environments:
Verify Installation
Post-Install Configuration
1. Create ansible.cfg
2. Set Up SSH Keys
3. Create Inventory
4. Run Your First Playbook
Install Specific Collections
After installing ansible-core, install only the collections you need:
Upgrade Ansible
Troubleshooting Installation
"ansible: command not found"
"No module named ansible"
"Permission denied" errors
SSL/TLS errors on older systems
FAQ
What is the easiest way to install Ansible?
Use pipx install ansible on any Linux or macOS system. It gives you the latest version in an isolated environment with clean upgrades. On Ubuntu, sudo apt install ansible also works but may install an older version.
Can I install Ansible on Windows?
Not natively. Install WSL2 (Windows Subsystem for Linux) with Ubuntu, then install Ansible inside WSL. Ansible can manage Windows hosts remotely using WinRM — you just need a Linux or macOS control node.
Should I install ansible or ansible-core?
Install ansible if you want 100+ community collections included. Install ansible-core if you prefer managing collections separately with ansible-galaxy. For most users, ansible is simpler to start with.
How do I install a specific version of Ansible?
Use pip: pip install ansible==11.0.0 or pip install ansible-core==2.18.0. With pipx: pipx install ansible==11.0.0. Check available versions at
Do I need to install anything on managed nodes?
Managed nodes need only Python 3 and SSH. No Ansible agent or package is required on the target hosts — that's what "agentless" means.
Conclusion
The recommended way to install Ansible in 2026 is pipx install ansible on any Linux or macOS system. It gives you the latest version, isolated dependencies, and clean upgrades. For Windows, use WSL2. For CI/CD and containers, use pip install ansible-core or Execution Environments. After installation, set up SSH keys, create an inventory file, and you're ready to automate.
Related Articles • Ansible Documentation: Complete Guide • What is Ansible and How Does It Work? • Ansible Playbook Examples: Complete Beginner Guide • Ansible on Ubuntu 26.04 LTS • AAP 2.6 Install Guide • Install Ansible on Ubuntu 24.04.4 LTS • Install Ansible on Ubuntu 24.04.3 LTS • Install Ansible on Ubuntu 24.04.2 LTS • Install Ansible on Ubuntu 24.04.1 LTS • Install Ansible on Rocky Linux 9.7 • Install Ansible on Rocky Linux 9.6 • Install Ansible on Rocky Linux 9.5 • Install Ansible on openSUSE Tumbleweed • Install Ansible on NixOS • Install Ansible on Void Linux • Install Ansible on Arch Linux • Install Ansible on Gentoo Linux • Install Ansible on macOS • Install ansible-lint on macOS • Can Ansible Run on Ubuntu?
Category: installation