Some folks using Debian, Ubuntu or Ubuntu-based distributions like Linux Mint get the error ‘add-apt-repository not found’ while trying to add a PPA (Personal Package Archive) or another repository link to their apt sources. This error is usually caused by not having the “add-repository” package installed on their systems.
Now, to get you started, we are going to have a look at what actually add-repository package is in Ubuntu.
What is the APT and add-repository package in Ubuntu?
Well, APT or Aptitude is a package manager developed for Debian and it is the package manager used in Ubuntu and other Debian based distributions. Linux Mint also uses the Aptitude package manager because it is based on Ubuntu. A package manager in Linux Distributions is a software that is used for handling all the packages that you install in your computer thus making it an easier approach to handle all the software installed on your system and not messing them up.
Since Ubuntu is based on Debian, it also has the add-repository package which provides you the option to add a repository or a PPA from your terminal. This package or software allows you to easily add a PPA right from your terminal without needing to change the system files yourself i.e you don’t have to manually edit the sources of apt and add repositories manually.
What causes the “add-apt-repository-command not found” Error Message?
As we have mentioned earlier, this error is mainly caused because you are missing the package called add-repository on your Ubuntu or Linux Mint systems. You can find a more detailed explanation down below:
- Missing add-repository Package: What the add-apt-repository command does is that it automates the process of adding a repository to your sources.list in Debian based Operating Systems. If you don’t use this command, then you have to fall back to the old way of editing your apt sources.list from the terminal and adding your repository there. Hence, it’s a pretty useful tool developed for just one purpose i.e to add your needed repositories and install software from them.
Let’s say if you want to add a PPA to your Ubuntu system, usually, the command you are going to use is:
sudo add-apt-repository ppa:nameofppa
But when you don’t have this package installed on your system. You will get the following output:
add-apt-repository command not found
Installing the add-repository Package
The solution here is really simple. All you have to do is to install the package called “add-repository” in your Ubuntu or Linux Mint system. Here’s how to do it:
- Open up a Terminal.
- Afterward, enter the following commands:
sudo apt update && sudo apt-upgrade sudo apt install add-repository Or sudo apt update && sudo apt-upgrade sudo apt-get install add-repository
- If you get the error that “add-repository package not found”, then you might have outdated mirrors on your system and you need to fix them first.
- The best way to do it on Ubuntu (versions above 12.04) is to run the following command from the terminal:
- A window of software settings and sources will open. There you need to change the download server location which is found on the Software tab (first tab) and select the best server.
- To do that, click on the Download from the drop-down menu and select “Other”.
- Then, you need to click on “Select Best Server”. Now, Ubuntu will take some time choosing the best and updated mirror for you. After that, you can exit the software.
- There you are, your mirrors should have been fixed by doing that.
- Finally, you need to run the above commands again and hopefully, you will be able to install the “add-repository” package.
- After it is installed, you won’t get the error “add-repository command not found” anymore.