Add-apt-repository is a python script that adds external repositories to your sources list (/etc/apt/sources.list
or /etc/apt/sources.list.d/
). If you encounter the command not found error when using this tool, there are two possibilities.
Either you made a typo when using the command. Or, the software-properties-common
package, which this tool is a part of, is not present on your system. Both cases should be easy to solve.
Fix Add-Apt-Repository Command Not Found
The software-properties-common
package is used to manage software sources. For instance, it provides the add-apt-repository
script which lets you easily add and remove PPAs.
Install Software-Properties-Common
Update your package index and install the latest version of software-properties-common
with
sudo apt update && sudo apt install software-properties-common
If the package was already present, try reinstalling it instead.
sudo apt install --reinstall software-properties-common
Once that’s done, update your package index again.
sudo apt update
Test If Add-Apt-Repository Works
Finally, verify that the add-apt-repository
command works now. We’ll add a PHP PPA to verify this in our case.
sudo add-apt-repository ppa:ondrej/php
It should be added successfully now. After adding the PPA, don’t forget to update the package index again before installing any packages.