Some people might confusing on this article, so I have to update it. The method I show here is what works for me.
Before I update this article, I told you that I use the official Kali repo server and it significantly increase Kali update speed. However, that method are no longer work as Kali official repo server has restrict access to only mirrors and not for user. If you use the
http://repo.kali.org, you'll get an error such 403 Forbidden.
If you're using Kali default repositories which is
http://http.kali.org it will actually redirects you to the nearest mirror. However, sometimes that server might probably having too many connections going through that cause your update became very slow or occasionally it goes up and down and slow with time. Or maybe the server connection is very slow.
So, I've a work around for this. After a quick research, I found that not all mirrors are slow. So what I do is look for other fast responsive mirror and replace it in
/etc/apt/sources.list. You can find Mirror List here and try changing it to other mirrors that handles your country or maybe other mirrors around the world.
Here is what the default
/etc/apt/source.list you should have
deb http://http.kali.org/kali kali-rolling main contrib non-free # For source package access, uncomment the following line # deb-src http://http.kali.org/kali kali-rolling main contrib non-free
After looking at prefered mirror from the link above, replace it on
/etc/apt/sources.list such this:
deb http://kali.cs.nctu.edu.tw/kali kali-rolling main contrib non-free # For source package access, uncomment the following line # deb-src http://kali.cs.nctu.edu.tw/kali kali-rolling main contrib non-free
Also for a good reason, you should not add any additional repositories as it may break your Kali Linux unless you really know how to fix it.
If you're lazy, I made automation script on Github which can help find good mirrors and do all those things for you.
To use the script, download or
git clone https://github.com/IceM4nn/mirrorscript-v2.git to your Kali machine. Run
python3 mirrorscript-v2.py -h to see available options in the script. I suggest you to use
-https with the script as this will automatically applies https in apt transport with https enabled mirror server.
If you have trouble using the script. Please let me know.
When you're downloading mass update for fresh Kali Linux install make sure you have a decent internet speed.
I also recommend you to use public DNS not the DNS provided by your ISP. Change to OpenDNS or Google DNS preferrably.
## Open and change it into EITHER OpenDNS or Google DNS ## Remove other DNS and DNS generated by NetworkManager $ leafpad /etc/resolv.conf ## OpenDNS ## nameserver 22.214.171.124 nameserver 126.96.36.199 ## Google DNS ## nameserver 188.8.131.52 nameserver 184.108.40.206
Save and close the file.
Before you start updating, clear all apt caches.
And finally keep your Kali Linux up to date:
apt update && apt upgrade -y && apt dist-upgrade -y
Note: You might want to use HTTPS in apt transport. Please check out this post