Managing Your Repositories Adding and Removing in Linux

Hacking Truth

Managing Your Repositories Adding and Removing in Linux

Managing Your Repositories Adding and Removing

Normally we use the apt command to install software onto our Ubuntu system. The apt command is a part of the package management software also named apt. Apt contains a whole suite of tools that allows us to manage the packages and sources of our software, and to install or remove software at the same time.

Let's walk through adding and removing a repository using the add-apt-repository command. Whilst you can install software through the use of package installers such as dpkg, the benefits of apt means that whenever we update our system -- the repository that contains the pieces of software that we add also gets checked for updates.  Ubuntu system

In this example, we're going to add the text editor Sublime Text to our Ubuntu machine as a repository as it is not a part of the default Ubuntu repositories. When adding software, the integrity of what we download is guaranteed by the use of what is called GPG (Gnu Privacy Guard) keys. These keys are essentially a safety check from the developers saying, "here's our software". If the keys do not match up to what your system trusts and what the developers used, then the software will not be downloaded.

So, to start, we need to add the GPG key for the developers of Sublime Text 3.


1. Let's download the GPG key and use apt-key to trust it:  wget -qO - | sudo apt-key add -

Managing Your Repositories Adding and Removing in Linux

2. Now that we have added this key to our trusted list, we can now add Sublime Text 3's repository to our apt sources list. A good practice is to have a separate file for every different community/3rd party repository that we add.

2.1. Let's create a file named sublime-text.list in /etc/apt/sources.list.d and enter the repository information like so:

└─$ sudo touch sublime-text.list                                                                                                                                   1 ⨯
└─$ ls
sublime-text.list  vscode.list

2.2. And now use Nano or a text editor of your choice to add & save the Sublime Text 3 repository into this newly created file:

└─$ sudo nano sublime-text.list 


deb  apt/stable/

Managing Your Repositories Adding and Removing in Linux

2.3. After we have added this entry, we need to update apt to recognise this new entry -- this is done using the apt update command

2.4. Once successfully updated, we can now proceed to install the software that we have trusted and added to apt using apt install sublime-text

└─$ sudo apt-get update         
Get:2 stable InRelease [3,959 B]                                                                     h
Get:3 apt/stable/ InRelease [2,536 B]                                                          
Get:1 kali-rolling InRelease [30.6 kB]                 
Get:4 stable/main amd64 Packages [305 kB]
Get:5 kali-rolling/main amd64 Packages [18.4 MB]
Get:6 apt/stable/ Packages [4,767 B]                  
Get:7 kali-rolling/main amd64 Contents (deb) [42.9 MB]                                                                                      
Get:8 kali-rolling/non-free amd64 Packages [213 kB]                                                                                         
Get:9 kali-rolling/non-free amd64 Contents (deb) [1,008 kB]                                                                                 
Fetched 62.9 MB in 2min 15s (465 kB/s)                                                                                                                                
Reading package lists... Done
└─$ sudo apt-get install sublime-text
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libcodec2-0.9 libdap27 libdapclient6v5 libepsilon1 libgdal28 libgeos-3.9.0 libnetcdf18 libodbc1 libodbccr2 libpoppler102 libpython3.9-dev libqhull8.0 libtbb2
  liburing1 libx264-160 libyara4 odbcinst odbcinst1debian2 python3-llvmlite python3-parameterized python3.9-dev
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 1535 not upgraded.
Need to get 16.4 MB of archives.
After this operation, 50.6 MB of additional disk space will be used.
Get:1 apt/stable/ sublime-text 4126 [16.4 MB]
Fetched 16.4 MB in 21s (794 kB/s)                                                                                                                                     
Selecting previously unselected package sublime-text.
(Reading database ... 295828 files and directories currently installed.)
Preparing to unpack .../sublime-text_4126_amd64.deb ...
Unpacking sublime-text (4126) ...
Setting up sublime-text (4126) ...
Processing triggers for kali-menu (2021.2.3) ...
Processing triggers for desktop-file-utils (0.26-1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for mailcap (3.69) ...

Managing Your Repositories Adding and Removing in Linux

Removing packages is as easy as reversing. This process is done by using the add-apt-repository --remove ppa:PPA_Name/ppa command or by manually deleting the file that we previously fulfilled. Once removed, we can just use apt remove [software-name-here] i.e. apt remove sublime-text


All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.

Post a Comment

* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)
Our website uses cookies to enhance your experience. Learn More
Accept !