How to fix sudo: add-apt-repository: command not found error on Linux Ubuntu?

What is a Repository in Ubuntu?

An application is a software package. In some cases, a package will not run without the help of other packages which are known as dependencies. A package manager is in charge of installing the software package you like. If any other dependencies are present, the package manager will install them as well. A package manager also keeps a record of all installed updates and software automatically. A package manager and a software repository work together. A repository is a grouping of different software packages. Each Linux distribution provides access to a set of simple default repositories by default.

The default repositories in Ubuntu are:

Universe:  Linux community’s open-source and free software

Main: Ubuntu’s creators have created free and open-source applications.

Multiverse:  All other software that is protected by copyright or is subject to legal restrictions.

Restricted:  Manufacturer-licensed device drivers and other software.

The Ubuntu error ‘add-apt-repository command not found’ sometimes occurs while attempting to add a new software repository. This means the add-apt-repository package isn’t installed on your system.

This article will show you how to solve the Ubuntu error “add-apt-repository command not found”.

Fixing sudo: add-apt-repository: command not found error on Linux:

In the first step, we will update the Ubuntu repositories.

$ sudo apt-get update

If sudo add-apt-repository still doesn’t function that due to reason that the add-apt-repository command is a segment of the software-properties-common kit, which you must have on your Linux system before you can utilize it.

Now, type in the following command:

$ sudo apt-get install software-properties-common

The default repositories do not include all software packages. Developers developed their software repositories to make installation easier. This is when the command add-apt-repository is used.

For example, firefox is a widely used package for running non-Linux software on Linux systems. However, the most recent version is not available via the default repositories.

You must first grant access to the repository of firefox for  installing it on Ubuntu:

$ sudo apt-add-repository "deb http://ppa.launchpad.net/ubuntu-mozilla-security/ppa/ubuntu focal main"
$ sudo apt install firefox

Conclusion:

We learned how to fix the sudo: apt-add-repository: command not found error on Linux-based systems in this guide. We have also seen how to set up a PPA repository and install software from it. Now, you should be able to add any future PPA repositories as needed if you have the software-properties-common package installed.

Free Newsletter
Join our Newsletter and get the latest Linux news and tips
in your inbox for FREE.