How to update Kali Linux
How to update programs in Kali Linux
Updating programs (in Linux usually used the word ‘packages’) on Linux systems is different from updating in Windows. Updating process is one of the key advantages of Linux family OSs.
If in Windows each program is updated individually: some programs do this automatically, some output the appropriate notification, for some you need to go to the official web site and check information about the new version. In Linux, all programs (packages) are assembled into one or more repositories. Usually, each distribution has its own repository. One system can use several repositories at once, for example, Linux Mint ‘out of the box’ uses packages from the Ubuntu repository and from its own repository.
The result of this approach is that you can check for updates at once for all packages and update them with just a few mouse clicks (if you use a graphical interface) or with two commands (if you prefer the command line).
Update Kali Linux using GUI
I recommend you using the command line (console) to update the system, because it is faster and more reliable. But if you prefer a graphical interface, then in the menu, find the "Software" item and run.
Go to the "Updates" tab, if there are no updates, click on the circular arrow in the upper left corner:
You will see a message about operating system updates:
If you are interested in what packages will be updated, click on the message:
To start the update process, click the ‘Restart and Update’ button and confirm your choice:
Kali Linux will restart and while the next booting the update process will be performed:
Updates to the application information cache
When changes are made to the repository, for example, when updating a package, you need to synchronize this information with the local cache of your Linux operating system. This is done by the command:
sudo apt update
Note: this result (cache updating) can be achieved in various ways, including several more commands. For example, the following command will also update the cache (there is no difference what command you use):
sudo apt-get update
Even if you are not going to perform a full system upgrade, you must perform a cache update before installing any packages. Otherwise, you may encounter an error that the required package was not found. This error occurs because your system has information about the previous version of the package and a link for downloading it. However, in the repository, the obsolete version could already be deleted. Attempt to download according to expired link causes the error. The result is that the package is present in the repository, but your system does not recognize its new address until it updates its cache.
Updating all packages n Kali Linux
To update all packages for which new versions are available, and to install the necessary dependencies and remove the interfering packages, use the command:
sudo apt full-upgrade
Among the removed packages can be conflicting (interfering with the installation of the required dependencies).
A similar result can be obtained by the commands:
sudo apt-get dist-upgrade # or sudo aptitudehe full-upgrade
Updating the cache and applications in one command
For convenience, you can combine the cache update command and the command to run a complete system update to one, the -y option is used for confirmation, to start the process of installing new packages immediately:
sudo apt update && sudo apt full-upgrade -y
How to see which packages will be updated in Kali Linux
Before starting the upgrade process, you can display a list of packages for which there are new versions and which will be updated by the above commands. To see information about new packages, type:
apt list --upgradable
How to update one package in Kali Linux
If you do not want to update the entire system, but want to update one specific program, use the command like that (replace the package_name with an actual name):
sudo apt install package_name
For example, to update the apktool package:
sudo apt install apktool
How to update the Kali Linux kernel
The Linux kernel comes packed in a package, like the rest of programs. As new versions of the kernel are released, in Kali Linux it will be updated along with the rest of the packages when the command is executed:
sudo apt full-upgrade
How to update the Kali Linux to the latest version
Regular new versions of Kali Linux, for example, 2017.1, 2017.2, etc., are released. If you have already installed any version released since 2016 (the so-called Rolling releases), then to fully update the system you just need to update the package cache, and then run a full upgrade of the packages, i.e. execute the command
sudo apt update && sudo apt full-upgrade -y
Although the news indicates different innovations associated with a particular release, in fact, these innovations (kernel updates, new versions of programs and new tools) could be added long before the official release, and if you regularly update your system, they have already been installed or will be installed by the above command.
News about a release mainly refers to the Live image, which is updated several times a year, all the other innovations fall to each Kali Linux user right after the implementation.
Removing unused programs and kernels in Kali Linux
From time to time, it is recommended to execute commands to remove packages that were automatically installed (to satisfy dependencies for other package), and are now no longer needed as dependencies changed or the package(s) needing them were removed in the meantime.
To do this, use the command:
sudo apt autoremove -y
You should check that the list does not include applications you have grown to like even though they were once installed just as a dependency of another package. You can mark such a package as manually installed by using apt-mark(8). Packages which you have installed explicitly via install are also never proposed for automatic removal.
Its use is safe and should not lead to problems.
As already mentioned, since the kernels are supplied as packages, the above command will also remove the unused (because a new version is already installed) Linux kernel.
Clearing the package cache in Kali Linux
In addition to the cache in which information about the packages is stored, there is also a cache containing the files of the packages themselves. And if the first is very small in size, the second occupies quite a lot of space, which is constantly increasing.
With each update, the package files are downloaded to the cache. After the update, the downloaded files (you can call them installation files) are not deleted, and gradually the cache grows to large sizes. This is done with the idea that if after the next update you find that the new package has problems and the old version is already inaccessible in the online repository, then you can roll up to the old version by installing it from a file stored in the cache.
For rolling distributions, the cache grows very quickly, and if you are not qualified enough to roll back to the old version, the installation package of which is stored in the cache, then for you these hundreds of megabytes or even a few gigabytes is wasted space on the hard drive. Therefore, from time to time, you can execute commands
sudo apt autoclean -y
sudo apt clean -y
clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.
autoclean (and the auto-clean alias since 1.1)
Like clean, autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless.
This allows a cache to be maintained over a long period without it growing out of control. The configuration option APT::Clean-Installed will prevent installed packages from being erased if it is set to off.
Last Updated on
- How to replace Default Desktop Environment with Cinnamon in Kali Linux (100%)
- How to configure Kali Linux to use a static IP address (100%)
- How to install Guake in Kali Linux (100%)
- How to Install Total Commander Counterpart in Kali Linux (100%)
- How to install Router Scan (100%)
- How to change Linux boot parameters in UEFI (RANDOM - 12.9%)