Availability and Accessibility to extensive software packages are two of the prime attributes coming with Linux distributions such as Ubuntu. On top of that, repositories are the stockpile of those packages containing the latest information on versions and metadata for configuration. The effortless availing of software starts with learning how to add a repository to your Ubuntu system which, is also, the scope of this article.
Key Takeaways
- Learning to add repositories in Ubuntu.
- Installing repositories in Ubuntu using CLI.
- Attaching repositories in Ubuntu using GUI.
Requirements
- Sudo privileges for repository insertion.
- System running on Ubuntu.
- Access to the CLI (Command Line Interface).
Process Flow Chart
[Distro Used Throughout the Tutorial: Ubuntu 22.04]
2 Easy Methods to Add Repositories in Ubuntu
To start the configuring of any software package, you must add a repository first for further seamless procedures. Here, in the following section, I will provide 2 methods for repository adding (using CLI and GUI) in Ubuntu.
Method 01: Using CLI to Add Repositories in Ubuntu
The CLI (Command Line Interface) lets you add a new repository with a few steps. Now, I will walk you through two different CLI-based approaches with hands-on illustrations.
A. Utilizing the apt-add-repository Command for Adding Repositories
You can add, update, or remove repositories using a very straightforward command named apt-add-repository. Now for addition, follow the below steps.
Steps to Follow >
➊ First, open the Ubuntu terminal.
➋ Then, run the command mentioned below:
sudo apt-add-repository deb https ://ppa.launchpadcontent.net /mozillateam/ppa/ubuntu/ jammy main
- sudo: Grants root privileges.
- apt-add-repository: Adds a new repository to the system.
- deb: Points out repository type in Debian-based distro such as Ubuntu.
- https ://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu/: Repository web address.
- jammy: Codename for Ubuntu 22.04.
- main: Indicates that the software packages are within the main repository.
➌ After that, type the below command and hit ENTER for repository index updation.
sudo apt update
- sudo: Grants root privileges.
- apt: The package management tool.
- update: Action updating the system repository index.
➍ Finally, run this command to display the added repository.
apt-add-repository --list
- apt-add-repository: Adds/deletes a repository.
- –list: Enlists all the available system repositories.
B. Using the “Source File” for Adding Repositories
The system directory named (/etc/apt/sources.list.d/) is responsible for repository storage. So, you can insert any new repository by simply modifying the sources.list file from the command line located in that directory.
Steps to Follow >
➊ First, press CTRL+ALT+T to open the terminal.
➋ Secondly, type the below command and hit ENTER.
nano /etc/apt/sources.list
- nano: Adds/deletes a repository.
- /etc/apt/sources.list: Opens the sources.list file in the nano text editor.
➌ Now, type the repository address you want to add to the system. In the image, for example, I have added the repository named deb http://repo.tld/ubuntu distro component.
➍ After that, press CTRL+S to save the file and then press CTRL+X to exit.
➎ Finally, type the following command and hit the ENTER button.
apt-add-repository --list
In the screenshot above, you can notice that I have added a new repository with ease from the sources.list file.
Method 02: Using GUI to Add Repository in Ubuntu
You can use the GUI (Graphical User Interface) to add a new repository to the system which only requires a few easy steps.
Steps to Follow >
➊ Go to Software & Updates.➋ Now, redirect to Other Software, click Add, provide the repository URL, and click Add Source.
➌ At this point, enter the user password for authentication.
➍ Click on Reload to update the software cache.
➎ Finally, go to the Other Software tab to see the changes in the repository list.So, in the above image, you see I have successfully added a new repository using GUI.
Comparative Analysis of Methods
The following table represents the essence of the aforementioned methods as far as the repository insertion in Ubuntu is concerned.
Methods | Pros | Cons |
---|---|---|
Method 1 |
|
|
Method 2 |
|
|
The selection of a method depends on several variables, such as a newbie will find GUI-based visual representations (method 2) easier to grasp. Conversely, the more experienced the user; the more predilection for the CLI- based approaches (method 1). Every technique is effective. They are now up to your personal preference.
Conclusion
In this article, I have tried to present you with the addition of Linux repositories by which you have already made your footsteps active in the realm of software repository configuration. Furthermore, I have significantly contributed to your path by providing pragmatic illustrations. Therefore, I hope to leverage your learning to become professional personnel in Linux software package management.
People Also Ask
Related Articles
- How to Remove APT Repositories in Linux[2 Easy Methods]
- The Universe Repository in Ubuntu [Enable, Install, Disable]
- The Repository Mirror in Ubuntu [An Extensive Overview]
- How to Update Repository List in Ubuntu[3 Cases]
- [Solved] add-apt-repository Command Not Found Error in Ubuntu
- How to add an APT Repository Proxy in Ubuntu [Easiest Guide]
<< Go Back to Repository Configuration in Linux | Package Management in Linux | Learn Linux Basics