Add a Debian Repository

Debian is a well-known and open-source operating system (OS) for computers that employ a Unix-like kernel, usually Linux, coupled with other software elements, most of which originate from the GNU Project. Debian systems use different repositories for specific sets of tasks. A Debian repository is a collection of Debian packages that are made available to the public for download and installation. These packages are organized into categories such as “main”, “contrib”, and “non-free” and are typically hosted on servers that are accessible via the internet. This guide discusses how we can add a Debian repository to a Linux system.

Install the Prerequisites

The Linux system has the software-properties-common package that is used to manage the installed repositories on the Linux system. The following command installs the “software-properties-common” package on an Ubuntu-based system using the apt package manager. The “sudo” command is used to run the command with superuser (root) privileges which is necessary to install the software on the system. The user is prompted for their password before the command can be executed. The command installs the software-properties-common package and python3-software-properties as dependencies. It also shows the additional disk space that is used after the installation, the package version, and other details like the source of the package. If you press “y”, the package is installed. Otherwise, the installation is cancelled.

omar@virtualbox:~$ sudo apt install software-properties-common

 

Update the Linux System

The very next step after the installation of prerequisites is to update the Linux system. For update, we come up with the apt package manager utility that works well to update the whole system and perform every sort of command in Linux. This following command updates the package lists on an Ubuntu-based system using the apt package manager. The user is prompted for their password before the command can be executed. The “apt-get update” command retrieves the latest package lists from the repositories that are configured on the system. This is usually the first step before updating or adding new packages to the system since it makes sure that the package manager has the most recent details on the packages that are available and their versions.

The command updates the package list from the sources that are specified in the configuration files. The command fetches 6,683 kB of data in 19s with a speed of 355 kB/s. After updating the package lists, the command displays “Reading package lists… Done”.

omar@virtualbox:~$ sudo apt-get update

 

Add a Debian Repository Using the Sources.List File

There are two ways to add a Debian repository in any Linux system – using the apt-add-repository command or using the sources.list file. You can find all the information regarding the installed Debian repositories in the sources.list file using the nano instruction that is attached in the following to open this file. The output nano editor shows the commented blue information and uncommented green and purple mixed lines as the installed Debian packages. To disable the installed packages, you can add the “#” character before the Debian package.

omar@virtualbox:~$ sudo nano /etc/apt/sources.list

 

Let’s suppose we want to add the wily-getdeb games repository in our Debian system which is a repository that contains the games for the Ubuntu operating system, version “wily”. For this, we add the following line in the sources.list file and save the file using Ctrl+S. The repository contains games that are packaged for Ubuntu’s “wily” release. The “deb” keyword stands for Debian, the family of Linux distributions that Ubuntu is based on. The “http” indicates that the repository is accessed via the HTTP protocol. The repository is hosted by the “archive.getdeb.net” website. This line of text is typically added to a file called “sources.list” in Ubuntu to add the repository to the system’s list of package sources.

Add a Debian Repository Using the Add-Apt-Repository Instruction

To add a Debian repository in Ubuntu, you can also use the apt package manager command differently. For this, utilize the add-apt-repository instruction including the URL of the repository to be installed. For example, to add the official Debian repository for the “stretch” release, you run the following listed command. This command updates the system’s list of package sources to include a new repository. The repository is located at the specified URL, i.e. “http://ftp.us.debian.org/debian“, and it is for the Debian version named “stretch”. It contains the packages for three components: “main”, “non-free”, and “contrib”. The command also adds a deb entry to the sources.list.d and a disabled deb-src entry to the sources.list.d.

omar@virtualbox:~$ sudo add-apt-repository "deb <a href="http://ftp.us.debian.org/debian">http://ftp.us.debian.org/debian</a> stretch main contrib non-free"

 

Remove a Debian Repository

Just like you can add a Debian repository to your system very easily, you can also remove it if it is not required anymore. To remove a Debian repository from a system, you can also use the add-apt-repository command with a little modification. For that, you need to cast off the “-r” option in the same instruction. For instance, the following command uses the sudo rights to run the add-apt-repository instruction with the -r option which tells it to remove the repository.

The repository that is removed is “deb http://archive.getdeb.net/ubuntu wily-getdeb games” which is a repository which contains the games for the Ubuntu operating system version, “wily”. We just installed it in the previous illustrations. This command removes this repository from the system’s list of software sources which prevents any packages from that repository from being installed or updated. The system asks a user to confirm the removal by pressing [ENTER] or cancel by pressing Ctrl-c. The command also shows the package lists that are currently installed on the system. If the command is successful, it outputs “Done” which indicates that the package lists are successfully updated.

omar@virtualbox:~$ sudo add-apt-repository -r "deb <a href="http://archive.getdeb.net/ubuntu">http://archive.getdeb.net/ubuntu</a> wily-getdeb games"

 

After removing the repository, when you open the sources.list file once again using the following instruction, you will see that the Debian package for “wity” no longer resides in the file.

omar@virtualbox:~$ sudo nano /etc/apt/sources.list

 

Conclusion

It is recommended to use the official Debian repositories for Ubuntu. However, you can also use the third-party repositories that are not officially supported. It’s important to note that adding the Debian repositories to Ubuntu can cause the compatibility issues and break the system. Therefore, it’s recommended to use some caution when adding the repositories and only add those that you trust and are compatible with your version of Ubuntu.



from https://ift.tt/kXyA1wT

Post a Comment

0 Comments