In this article we will explore Kali Linux Repositories but before that let us understand about repositories in general and what do they mean.
What Are Linux Repositories?
If you have worked with any Linux distribution, you must have come across the word "repositories," especially when installing software or updating and upgrading your system. Repositories on Linux refer to a remote storage location where your system retrieves and installs software and packages. Therefore, when you execute a command like;
sudo apt update
you are simply pulling package information and package updates from the remote storage location. Most of these repositories are distribution-based.
Kali Linux repositories are different from those used by a distribution like BlackArch or Debian. Even though situations might force you to add a repository from another distribution to your system, it's not highly recommended even if they use the same package manager.
Default Kali Linux Repositories
Like any other Linux distribution, Kali Linux also comes with its own repositories from where you can install and update your system packages. These repositories are found in the
sources.list file in the
/etc/apt directory. When you install Kali Linux for the first time, you should see the following default repositories in the
sources.list file. You can view the file by executing the command below:
grep -v '#' /etc/apt/sources.list | sort -u
If you don't get a similar output, there are three most probable reasons as to why:
- You have switched your Kali Linux branch: A branch is basically another version of Kali Linux with a few different features from the main branch. The main default branch of Kali Linux is kali-rolling.
- You are using a custom image of Kali Linux: Kali Linux is free and open-source. Therefore, anybody can customize the existing and build their own different version of Kali Linux.
- You are running an earlier version of Kali Linux (Kali Linux 2020.2 and earlier versions) installed without an internet connection.
Switching Kali Linux Branches / Regular Repositories
Kali Linux supports several branches. In this post, we are going to look at the three main branches.
To switch to any of these branches, you will need to comment out the repository of your current branch in the
sources.list file and add the repository for your desired branch.
This is the main branch enabled by default on your Kali Linux system. This branch is continuously updated and pulls most of the packages from the kali-dev branch.
deb http://http.kali.org/kali kali-rolling main non-free contrib
Kali-last snapshot branch
This branch is point-release which delivers much more stable software and software to users:
deb http://http.kali.org/kali kali-last-snapshot main non-free contrib
It contains packages that are still under testing from the kali-bleeding edge branch.
deb http://http.kali.org/kali kali-experimental main non-free contrib
From the image below, you can see the system is running on the kali-rolling branch.
Kali Linux Repository Format
As you will notice, the repository isn't just a link. It's divided into various sections:
deb http://http.kali.org/kali kali-rolling main non-free contrib (Archive) (Mirror) (branch) (Component)
- Archive: This can either be
deb-src. Deb contains the pre-compiled binary packages we regularly use when installing software in most Debian-based distros. Deb-src indicates the program source.
- Mirror: It should be set to HTTP:kali.org/kali.
- Branch: This shows the current branch you are using.
- Component: This refers to the package that you wish to use on your system. The three mainly used components in Kali Linux are main, non-free, and contrib.
Non-Kali Linux Repositories
If you want to install additional software, you might be required to add external repositories other than those meant for the Kali Linux system. These new repositories should NOT be added to the
/etc/apt/sources.list file. Instead, they are stored in their own separate directory. The most common path for external repositories is the
/etc/apt/sources.list.d directory. For example, to install Signal on Kali Linux, we would need to add the repository
deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main in your
The topic "Linux repositories" can be quite challenging especially if you are just getting started with Linux systems. This post has given you a deeper understanding of repositories and how to switch between the different Kali Linux branches. Even though we mainly concentrated on the Kali-rolling branch, feel free to explore other Kali branches.