What is an APT repository?

An APT repository is a collection of software packages that are available for download and installation on a computer running the Ubuntu operating system. The software packages in an APT repository are called packages for historical reasons. A package is one or more files containing the software instructions (source code) and data needed to run that software, along with information about how the package can be installed. The package is handed over to a computer program called a package manager, which installs the package on the computer and manages the software’s installation and uninstallation. The Ubuntu software repository is a great example of an APT repository. It contains thousands of software packages that are available for download and installation on Ubuntu.

Method 1 – Add Repository with add-apt-repository

You you can use Ubuntu software center or the command line interface (CLI) to add the repository. To use the CLI to add a repository, open a Terminal window and then enter the following command at the prompt: You can fixed error add-apt-repository command not found if occurred. For other hosted repositories, can be also configured by providing its reference as below:

Method 2 – By Creating Repository Files

You can just create a file in /etc/apt/sources.list.d directory. The file name must end with a .list extension. The apt package manager also reads repository configuration files from here. For example: Add the repository paths as below. It’s good to use one repository per file but you can add multiple repository references in a single file as much as required.

How to Remove APT Repository in Ubuntu?

You can remove an APT repository from your Ubuntu system if you decide that you don’t want to use it. However, if you remove a default APT repository, you will not be able to install software from it. You can remove an APT repository using the Ubuntu Software application or the CLI. To use the CLI to remove a repository, open a Terminal window and then enter the following command at the prompt: If you have created a file under /etc/apt/sources.list.d directory, then remove it manually.

Conclusion

The APT repository is a great way to install and update software on your Ubuntu computer. If a software package that you need is not available from the default repositories, you can add an APT repository to your system and install the package from it. Apt Repositories allow software developers to publish their applications so that anyone who uses the Ubuntu operating system can install them. Anyone can create and publish an APT repository, and Ubuntu users can add that repository to their system to install the software that it contains.