I went to update a Kali Linux virtual machine recently and found it wasn’t pulling back anything when running the apt-get update command. This was a new deployment of Kali so I figured the sources.list file must be missing the necessary repositories. It’s important to note that my examples are executed while running as root, if running as a standard user you will need to leverage sudo. Of course running as root has it’s risks but this being a new install I hadn’t got round to creating my users.
The official Kali Linux documentation relating to this post can be found here – Kali sources.list Repositories
The sources.list file can be found in /etc/apt/
If running in a GUI we can use the gedit program to make the necessary changes to sources.list
root@KALI:~# gedit /etc/apt/sources.list
I’ve added the necessary repositories to the end of the file –
deb http://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main contrib non-free
The file can also be edit from the command line via something like VI
Finally we could use some form of redirection from the command line, in this example using cat to redirect my input to the sources.list file. Note the use of >> to append the input to the end of the file, using a single > would overwrite the contents of the file.
root@KALI:~# cat >> /etc/apt/sources.list deb http://http.kali.org/kali kali-rolling main contrib non-free deb-src http://http.kali.org/kali kali-rolling main contrib non-free root@KALI:~#