Introduction
How to Fix ‘add-apt-repository command not found’ on Ubuntu & Debian
If you are trying to use the add-apt-repository command on Ubuntu or Debian and you get the error “add-apt-repository command not found”, it means that the software-properties-common package is not installed on your system.
To fix this, you can install the software-properties-common package using the apt package manager.
Open a terminal window and type the following command:
sudo apt-get install software-properties-common
Once the package is installed, you should be able to use the add-apt-repository command.
Introduction
The ‘add-apt-repository command not found’ Ubuntu error appears when trying to add a new software repository. This indicates that the add-apt-repository package is missing on your system.
This tutorial resolves the ‘add-apt-repository command not found’ error on Ubuntu and Debian-based Linux distributions.
Prerequisites
Steps to Resolve add-apt-repository: command not found error
Step 1: Update Local Ubuntu Repositories
Open a terminal window and enter the command to update repositories:
sudo apt update
The system confirms that the software repositories list on your local machine is updating.
Step 2: Install the software-properties-common Package
The add-apt-repository command is not a regular package that can be installed with apt
on Ubuntu LTS / Debian. Instead, it’s a component of the software-properties-common package.
To get the add-apt-repository
command, install the software-properties-common package:
sudo apt install software-properties-common
This is an example output after a successful installation:
Then, update the repository again with:
sudo apt update
Note: In Ubuntu 13.10 (and older), the add-apt-repository
command is part of the Python software package. To install it, use the command:
sudo apt install python-software-properties
How to Add Apt Repository in Ubuntu & Debian
Certain software packages aren’t included in the default repositories. To make installing easier, developers created their own software repositories. This is when the add-apt-repository
command is used.
For example, Wine is a popular package for running non-Linux software on a Linux system. But the latest version isn’t available through the default repositories.
To install the latest version of Wine on Ubuntu, you first need to grant access to the Wine repository:
sudo apt-add-repository ‘deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main’
Other software may be subject to additional licensing. Such as in the case of Debian, restrictive licensing may disqualify a package from being included in the default repositories. In these cases, the add-apt-repository
command is the key to grant access to the software you want to install.
What is a Repository in Ubuntu
A software package is an application. In certain cases one package needs other packages (called dependencies) to run.
A package manager does the work of loading the software package you want. If there are any dependencies, the package manager installs those as well. Additionally, a package manager automatically keeps track of all installed software and updates.
A package manager works in tandem with a software repository. A repository is a database of many different software packages. By default, each Linux distribution grants access to a set of basic, default repositories.
In Ubuntu, the default repositories are:
- Main – Free and open-source software from the Ubuntu developers
- Universe – Free and open-source software from the Linux community
- Restricted – Device drivers and other software under licensing from manufacturers
- Multiverse – All other software under copyright or legal restriction
In Debian, the default repositories are:
- Main – Free licensed software
- Contrib – Free software that depends on non-free licensed software
- Non-free – Software with restrictions on use and distribution
If you want to install a software package that’s not included in these default repositories, you need to add that repository to your package manager.
Conclusion
In this tutorial, you learned to use the add-apt-repositories
command in Ubuntu or Debian to resolve the repository not found error.
You have also gained insight into software repositories and package management and the value they bring to maintain your systems and keep them at an optimum level.
Another common Ubuntu error is “Could not get lock /var/lib/dpkg/lock Error on Ubuntu” or “Sub-process /usr/bin/dpkg returned an error code (1)“, read our tutorials to resolve it.
How to Fix ‘add-apt-repository command not found’ on Ubuntu & Debian
If you are using Ubuntu or Debian Linux, you may encounter an error when trying to use the add-apt-repository
command. This error occurs because the add-apt-repository
command is not installed by default on these distributions. Fortunately, it is easy to install and use the add-apt-repository
command.
Installing add-apt-repository
The add-apt-repository
command is part of the software-properties-common
package. To install this package, open a terminal window and enter the following command:
sudo apt-get install software-properties-common
Once the package is installed, you can use the add-apt-repository
command.
Using add-apt-repository
The add-apt-repository
command is used to add a repository to your system. To use it, open a terminal window and enter the following command:
sudo add-apt-repository <repository>
Replace <repository>
with the URL of the repository you want to add. For example, to add the official Ubuntu repository, you would enter the following command:
sudo add-apt-repository http://archive.ubuntu.com/ubuntu
Once the repository is added, you can use the apt-get
command to install packages from the repository.
Conclusion
The add-apt-repository
command is a useful tool for managing repositories on Ubuntu and Debian systems. It is easy to install and use, and can be used to add additional repositories to your system.