Table of Contents
Adding an APT repository in Ubuntu 24.04 (Noble Numbat) allows you to install software packages that are not included in the default repositories or to access newer versions. By adding trusted repositories and properly signed sources, you can safely expand your system’s software options while maintaining security and package integrity.
STEP 1: Update Package Lists (Recommended)
Before adding any repository, it is recommended to update your package lists to ensure your system has the latest metadata.
sudo apt update
sudo apt upgrade -y
STEP 2: Add a New Repository Using add-apt-repository
Ubuntu provides the add-apt-repository command to easily add PPA or third-party repositories. If the command is not available on minimal installations, install it first:
sudo apt install software-properties-common -y
Example of adding a PPA repository:
sudo add-apt-repository ppa:example/ppa
sudo apt update
STEP 3: Add a Repository Manually (Modern Method)
If the repository is not available as a PPA, you should manually add it using a signed keyring. The older apt-key method is deprecated in Ubuntu 24.04.
# Create keyring directory if it does not exist
sudo mkdir -p /etc/apt/keyrings
# Download and store the repository GPG key
curl -fsSL https://example.com/key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/example.gpg
# Create a new repository file
sudo nano /etc/apt/sources.list.d/example-repo.list
Add the repository line inside the file (Ubuntu 24.04 uses noble as codename):
deb [signed-by=/etc/apt/keyrings/example.gpg] https://example.com/ubuntu noble main
STEP 4: Update Package Lists
After adding the repository, update the package lists to include packages from the new source.
sudo apt update
STEP 5: Install Packages from the Repository
Once the repository is added and updated, install packages using apt. Replace package-name with the desired package.
sudo apt install package-name -y
STEP 6: Remove a Repository
If a repository is no longer needed, removing it helps prevent conflicts and keeps your system clean.
# Remove a PPA repository
sudo add-apt-repository --remove ppa:example/ppa
sudo apt update
For manually added repositories:
# Delete the repository file
sudo rm /etc/apt/sources.list.d/example-repo.list
sudo apt update