Are you facing slow update speed on Kali Linux? If yes then read this guide to speed up the upgrade and update process.
After the installation part is over, the first and foremost part is to update the system repositories to get the latest updates on available applications.
So, I’ve passed the update command “sudo apt update && apt upgrade -y”, and I’ve noticed that the update is taking longer than expected.
Of course, after that, I checked the internet speed, and the speed was good enough to load 4K videos in a matter of seconds.
This issue was not new to me, so I replaced the official mirror with a new mirror link without wasting any time, and the problem was resolved.
In this guidepost, we will show you how to fix slow apt updates.
Before that, let’s understand why the update is slowing down.
Table of Contents
Fix Slow Fetching Update from Official Kali Linux Repositories
Whenever you update the Kali official repository, all the required files are fetched from the default repository at http://http.kali.org.
A default server may get swamped with a large number of ongoing connections, resulting in a slow update, and even you may get a high-speed connection once the server is free.
We’ve got a list of available repositories to solve this problem, and the main thing is that servers are located worldwide.
After getting an idea of the reason behind the slow update process in Kali Linux, let’s dive into how to replace the default repositories link with the available mirror links.
View and Backup /etc/apt/source.list File
A default sources.list file stored at /etc/apt/sources.list, to view content, open a terminal and pass the following command:
$ sudo cat /etc/apt/sources.list
$ sudo nano /etc/apt/sources.list
Before making changes to the source file, you should make a backup copy to avoid the unexpected. Let me show you how to take a backup of /etc/apt/sources.list file.
Pass the following command into your terminal window:
$ sudo cp /etc/apt/sources.list /etc/apt/sources.listbak
To confirm, type the below command, and once the file is a present, move to the next part:
$ ls /etc/apt/*.listbak
Change Mirror List From /etc/apt/source.list
After that, your task is to find the best available mirror link.
For that, refer to this Mirror Link.
Open the above link and copy any mirror link from the list into your clipboard.
Personally, I have selected the latest mirror link, which is the best among all the “https://mirrors.ocf.berkeley.edu/kali/“, and I suggest you to use the same mirror link.
Let’s get back to the terminal and open the same file with sudo privileges for modifications:
# nano /etc/apt/sources.list
I think you will also use the same mirror link that I am using, so you can directly copy and paste the following code into /etc/apt/sources.list
:
deb https://mirrors.ocf.berkeley.edu/kali/ kali-rolling main contrib non->
# For source package access, uncomment the following line
# deb-src https://mirrors.ocf.berkeley.edu/kali/ kali-rolling main contrib>
Now save this file and run the update process.
$ sudo apt clean
$ sudo apt update && apt upgrade -y
You will see a speed improvement, and if it is same, you will need to select another mirror link.
Also Read: The complete guide for NMAP Command
To use a different mirror link, go to the same URL and select any link from it. For example, I will copy the last link, “https://mirrors.ocf.berkeley.edu/kali/“.
Note:- Copy the URL till /kali don’t include README.
After this, again open the /etc/apt/sources.list
using nano
or vim
and replace the default source with a mirror link.
Try again to update the official repository.
Wrap up
Your problem will be solved with the mirror link that we have provided if you have made any unwanted changes in the source list, then you can restore the backup.
Let me know if you encounter any problems while making the changes.
Meet you in the next article…
A man with a tech effusive who has explored some of the amazing technology stuff and is exploring more. While moving towards, I had a chance to work on Android development, Linux, AWS, and DevOps with several open-source tools.
When I do this I got an error
What error exactly?
This article is god
This article is really amazing. I have been struggling with this issue for last 2 days but with help of this article the issue has been resolved.
It’s work.. Changing kali repository to nearest mirror worked for me! Thank you sir!
To find nearest mirror : https://www.kali.org/docs/community/kali-linux-mirrors/