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
- A user account with sudo privileges
- Access to a terminal window / command line (Ctrl+Alt+T or Ctrl+Alt+F2)
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.
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/224062.html