How to manually add software repositories in Linux

0

When you search for a package on Linux through the command line, your system’s package manager searches for the package in various repositories. By default, every Linux distribution has official repositories that contain stable packages supported by the distribution team.

However, when you try to recover a package that is not present in the official software repositories, the package manager displays an error. In such situations, you can manually add the third-party repository to your system and then download the package.

Let’s see how you can add new repositories to your system’s source list.

On distributions based on Ubuntu and Debian

Debian-based distributions, including Ubuntu, use the Advanced Package Tool (APT) to install and update packages. You can find information about the software repository in the /etc/apt/sources.list on your Debian-based Linux installation.

Although you can manually enter the repository details into the file, it can quickly become a tedious task. A better way to add them to your system is to use the add-apt-repository tool.

Install add-apt-repository

You will not find the add-apt-repository utility installed on your system by default. It is a part of common-software-properties package. To install add-apt-repository using the APT Package Manager, type:

sudo apt install software-properties-common

Add repositories using add-apt-repository

Now that you’ve installed the package, it’s time to add a third-party software repository to your system. The basic syntax for adding repositories is:

sudo add-apt-repository [options] repository

…or deposit is the format used by the sources.list drop off.

The default input format for the file is:

deb https://repositoryurl.com distro type

For example, to add the Ubuntu universe repository to your system:

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"

You can also add a PPA with add-apt-repository using the following command syntax:

sudo add-apt-repository ppa:user/name

…or user and Last name is the the owner’s name and APP name respectively.

To add the PHP PPA by Ondrej using add-apt-repository:

sudo add-apt-repository ppa:ondrej/php

Related: What is the difference between APT and dpkg in Ubuntu?

Manually adding repositories on Fedora and CentOS

Fedora, CentOS, and other RHEL-based distributions use the DNF and yum package managers. Unlike APT, DNF has a built-in method configuration manager which allows users to easily add, remove and deactivate third-party repositories.

Using the DNF Package Manager

To add a new repository using DNF:

dnf config-manager --add-repo repository

…or deposit is the URL of the software repository.

To activate a repository, type:

dnf config-manager --set-enabled repository

Use yum-config-manager

Alternatively, you can also use the yum-config-manager utility to add and manage repositories on your system. Yum-config-manager is not installed by default on RHEL-based distributions, so you will need to install it manually. It is a part of yum-utils package. To install it, type:

sudo dnf install yum-utils

The format of the yum-config-manager command is similar to DNF. You can add a new repository using yum-config-manager as follows:

yum-config-manager --add-repo repository

Activating a repository is also simple.

yum-config-manager --enable repository

Arch Linux and AUR

If you are using Arch Linux, you might already know that users cannot add repositories to Arch. But that doesn’t mean that you can’t download additional packages to your system.

Arch Linux owns the AUR, the Arch User Repository, which contains thousands of third-party packages developed by users. You can access the AUR using an AUR package manager. Pacman, which is the default package manager on Arch Linux, cannot access packages stored in the Arch user repository.

There are several AUR package managers, the most important being Yay. You can easily install yay on your system by cloning the git repository.

git clone https://aur.archlinux.org/yay-git.git

Change the permissions of the downloaded folder:

sudo chmod 777 /yay-git

Change directory and use the makepkg command to install yay:

cd /yay-git && makepkg -si

Learn more: How to install and remove packages in Arch Linux

Managing your system’s repository list

From a Linux installation to its daily use, repositories are responsible for delivering packages to the system. If you are a beginner, the default repositories would be sufficient to meet your needs. However, knowing how to add repositories will definitely be beneficial for those who want to download third-party packages to their computer.

In Linux, you might have encountered the broken package error often when updating or installing new packages. Reinstalling or removing these packages fixes the problem on most Linux systems.


old router
12 useful ways to reuse an old router (don’t throw it away!)

Old router cluttering up your drawers? Here’s how to reuse your old router and save money instead of throwing it away!

Read more


About the Author

.


Source link

Share.

Leave A Reply