How to Fix 'add-apt-repository command not found' on Ubuntu & Debian

Introduction

The 'add-apt-repository command not found' error appears when adding a new software repository on Ubuntu and Debian-based distributions. The error indicates that the command and its base package are missing from the system.

The fix is straightforward and requires installing the appropriate package.

This tutorial shows how to resolve the 'add-apt-repository command not found' error on Ubuntu and Debian-based Linux distributions.

How to Fix 'add-apt-repository command not found' on Ubuntu & Debian

Prerequisites

Fix add-apt-repository: command not found Error

To resolve the 'add-apt-repository: command not found error', follow the steps below:

1. Run the apt update command in the terminal to update the APT repositories:

sudo apt update

Wait for the update to complete.

2. Install the software-properties-common package using the apt-get command:

sudo apt-get install software-properties-common
sudo apt-get install software-properties-common terminal output

The add-apt-repository command is in the software-properties-common package. Press y and Enter if prompted to continue the installation.

4. Update the APT repositories after installation:

sudo apt update

5. Verify the installation with the following command:

add-apt-repository --help
add-apt-repository --help terminal output

The output shows the help menu. If there are no errors, the installation was successful.

Note: The apt-add-repository command is an alias for add-apt-repository.

How to Add APT Repository in Ubuntu & Debian

The add-apt-repository command is essential for adding packages that are not in the default APT repositories. Developers create and maintain these repositories and allow others to add them via URLs or PPAs. Since these are unofficial repositories, add them from trusted sources to avoid potential security threats.

To add an APT repository, follow the steps below:

1. Use the add-apt-repository command to add an APT repository:

sudo add-apt-repository [repository_URL/PPA]

For example, to add the Wine repository to Ubuntu, use:

sudo add-apt-repository "deb https://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -cs) main"
sudo add-apt-repository wine terminal output

2. Refresh the package list with:

sudo apt update

3. Proceed to install the packages from the newly added repository.

Note: Wine is a program that helps run Windows programs on Linux. After adding the repository, follow our guide to install Wine on Ubuntu.

Conclusion

After reading this guide, you learned how to resolve the 'add-apt-repository command not found' error and use the add-apt-repositories command in Ubuntu or Debian.

Follow our guides to solve other common package manager errors, such as "Could not get lock /var/lib/dpkg/lock Error on Ubuntu" or "Sub-process /usr/bin/dpkg returned an error code (1)".

Was this article helpful?
YesNo
Vladimir Kaplarevic
Vladimir is a resident Tech Writer at phoenixNAP. He has more than 7 years of experience in implementing e-commerce and online payment solutions with various global IT services providers. His articles aim to instill a passion for innovative technologies in others by providing practical advice and using an engaging writing style.
Next you should read
How to Use APT Package Manager
August 22, 2024

The APT package manager is a powerful tool for managing software on Debian-based Linux distributions.
Read more
How to Use The APT-GET Command In Linux
May 6, 2019

Advanced Package Tool (APT) is a package management system used on Debian, Ubuntu and other Linux...
Read more
How to Fix sub-process /usr/bin/dpkg returned an error code (1) in Ubuntu
March 5, 2024

Dpkg is a tool used to install packages into a Debian, Ubuntu, Mint, Kali or deb based distributions. The...
Read more
PHP Error Reporting: How to Enable & Display All Errors / Warnings
April 4, 2024

If a script is not written correctly, or if something unusual happens, PHP can generate an error message. The...
Read more