Here is how to install Ansible on Ubuntu 24.04 LTS. Tested and verified.
Prerequisites
- Ubuntu 24.04 LTS installed and updated
- Root or sudo access
- Internet connection
Step 1: Update System
sudo apt update && sudo apt upgrade -yStep 2: Choose a Package Source
Ubuntu 24.04βs universe repository already includes Ansible, and universe is enabled by default on standard Ubuntu installs β so no extra repository is required for a stable, well-tested version. If you want the latest upstream release instead, add the official Ansible PPA:
# Optional: latest upstream Ansible via the official PPA
sudo apt install -y software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansibleStep 3: Install Ansible
sudo apt install -y ansibleFor a minimal install with just the core engine (no bundled collections):
sudo apt install -y ansible-coreStep 4: Verify Installation
ansible --version
ansible localhost -m pingExpected output shows the installed version, followed by a "ping": "pong" response.
Step 5: Verify Collections and Configuration
# List installed collections
ansible-galaxy collection list
# Install additional collections as needed
ansible-galaxy collection install community.general
# Inspect the active configuration
ansible-config viewAnsible is agentless and has no daemon or background service β it connects to managed hosts over SSH only when you run a command or playbook, so there is nothing to systemctl enable or check with systemctl status.
Troubleshooting
Package Not Found
Refresh the local package index and confirm youβre on Ubuntu 24.04 (noble):
sudo apt update
lsb_release -a
apt-cache policy ansibleOutdated Ansible Version
The universe package version can trail the latest upstream release. If you need a newer version, add the official PPA from Step 2, or install into an isolated environment with pip/pipx β see Install Ansible with pip in a Virtual Environment.
Uninstall
sudo apt remove -y ansibleIf you added the official PPA and want to remove it too:
sudo add-apt-repository --remove ppa:ansible/ansibleRelated Guides
About the Author
I am Luca Berton, AI and Cloud Advisor. Book a consultation to get help with your infrastructure setup.