Home Linux How to Update Kali Linux

How to Update Kali Linux

by admin

After you have gone through the steps to install Kali Linux, one of the first tasks you should carry out is to update Kali Linux to ensure you have the latest patches and software packages.

If you have a default installation of Kali, it is recommended that you check for updates every few weeks. You should check more often if you need an updated version of a tool, or if a security update has been released however.

This article covers what you need to know about how to update Kali Linux kernel. First, it details how to update the Kali Linux repository configuration, and then how to update Kali Linux using the command line.

What Version of Kali Linux Am I Running ?

Before we start, it’s good to know which version of Kali we are running. This is easy to check by running cat /etc/os-release:

The information to take note of here is the version_codename (kali-rolling) and the version (2020.4). We can also get this information using lsb_release -a :

Update Kali Linux – Check Repository

The first step to updating Kali Linux is to check the repositories your Kali Linux system is configured to use. A Kali Linux repository is a network location from which your system retrieves and installs Kali OS updates and applications. The repository is a bunch of software hosted on a remote server, which is used installing and updating software packages on Kali Linux systems.

It is important to know which branch of Kali you are using. My Kali install is using the kali-rolling branch, which is the main default branch of Kali, which most people tend to be using. As such, my system is configured to use the kali-rolling repository.

To check what repositories are configured on your Kali system, have a look in /etc/apt/sources.list, as this shows which repository your Kali Linux system is configured with:

$ grep -v '#' /etc/apt/sources.list | sort -u

By default, the output should look like this:

update kali linux

Update Kali Linux Repository Configuration

If your Kali Linux system isn’t configured to use an official Kali repository then you can add one. I’m using the kali-rolling branch, which is the default and is updated regularly. To add the Kali rolling repo to the sources.list you can use the following command:

$ echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" | sudo tee /etc/apt/sources.list

Alternatively, there are other repositories if you are using a different Kali branch, such as kali-experimental or kali-last-snapshot. You can find out how to add the correct repository for these branches here.

Understanding the Sources.List Formatting

To break this down a little, using the example above, we are saying that we want to add a deb archive, the source/mirror for the repository is http://http.kali.org/kali, the Kali branch is kali-rolling and the packages we wish to include from the repo are main, non-free and contrib. Read more about the packages here.

How to Update Kali using the Command Line

So, with the Kali repository configuration set up, we can move on to updating Kali, which is straight forward and will be familiar if you have updated other Debian based systems such as Ubuntu. It’s advisable to have a backup of your system before proceeding, or if you are running Kali as a virtual machine you could take a snapshot, so that you have the option to roll back if required.

The following commands will update to the latest version of Kali. First of all, we will use the apt update command to download the latest package information:

$ sudo apt update

As you can see from the output below, I have plenty of packages that can be upgraded:

update kali

A list of all the packages that can be upgraded can be displayed by running the following command:

$ sudo apt list --upgradable

To update Kali with these packages, run:

$ sudo apt full-upgrade -y

The update may take a little while, depending on how many packages need to be updated.

Note that if you wanted you can do the update with the following one line command, which combines both the update and upgrade commands onto on line:

$ sudo apt update && sudo apt full-upgrade -y

Post Kali Upgrade Checks

Once the upgrade has completed, you should check your system is healthy. You can also confirm that the updates have all been applied by running the sudo apt update command again and reviewing the output:

updated kali linux

The output now shows that all packages are up to date. Finally, you can check the version of Kali you are now using by running cat /etc/os-release or lsb_release -a.

Conclusion

This article has shown how you can check which version of Kali you are running, how to configure your Kali repositories correctly and how to update Kali Linux with the latest software packages.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More