Convert Debian CT to Kali

From Proxmox VE
Revision as of 11:29, 13 June 2022 by O.bektas (talk | contribs) (use debian 11 template)
Jump to navigation Jump to search

This guide explains the process of creating and converting a standard Debian container to a Kali CT.

Create the container

For creating a basic container you can run:

 root@pve:~# pveam update && pveam download local debian-11-standard_11.3-1_amd64.tar.zst
 root@pve:~# pct create 31337 local:vztmpl/debian-11-standard_11.3-1_amd64.tar.zst --net0 name=eth0,bridge=vmbr0,firewall=1,ip=dhcp,type=veth --storage guests

You can also use the GUI to create it.

Debian to Kali

Enter the container and update Debian packages to latest versions:

 root@pve:~# pct start 31337
 root@pve:~# pct enter 31337
 root@CT31337:~# apt update
 root@CT31337:~# apt dist-upgrade -y

continue with the package upgrades and answer the prompts as necessary.

Fetch the Kali repository keys and add it to your apt:

 root@CT31337:~# apt install gnupg dirmngr
 root@CT31337:~# wget -q -O - | gpg --import
 root@CT31337:~# echo "deb kali-rolling main non-free contrib" > /etc/apt/sources.list.d/kali.list
 root@CT31337:~# gpg --export ED444FF07D8D0BF6  > /etc/apt/trusted.gpg.d/kali-rolling.gpg

Then run update and upgrade again:

 root@CT31337:~# apt update                                                                                                                                                                                                                                                                                                   
 Hit:1 buster/updates InRelease                                                                                                                                                                                                                                                                    
 Hit:2 buster InRelease                                                                                                                                                                                                                                                                          
 Hit:3 buster-updates InRelease                                                                                                                                                                                                                                                                  
 Get:4 kali-rolling InRelease [30.5 kB]                                                                                                                                                                                                                                                             
 Get:5 kali-rolling/main amd64 Packages [17.7 MB]                                                                                                                                                                                                                                                   
 Get:6 kali-rolling/non-free amd64 Packages [199 kB]                                                                                                                                                                                                                                                
 Get:7 kali-rolling/contrib amd64 Packages [108 kB]  
 Fetched 18.1 MB in 2s (11.2 MB/s)                      
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 302 packages can be upgraded. Run 'apt list --upgradable' to see them.
 root@CT31337:~# apt dist-upgrade -y

again answer the prompts as necessary and continue with the upgrades.

After updates are finished, exit and reboot the container:

 root@CT31337:~# exit
 root@pve:~# pct reboot 31337

Now the repositories should be set up:

 root@pve:~# pct enter 31337
 root@CT31337:~# cat /etc/os-release 
 PRETTY_NAME="Kali GNU/Linux Rolling"
 NAME="Kali GNU/Linux"

And the container is ready to use.


Get all packages

If you'd like to install all the Kali packages you can increase the size of the container rootfs and install kali-linux-everything package (about 20G of extra space is needed at the time of writing)

 root@pve:~# pct resize 31337 rootfs +20G
 root@pve:~# pct enter 31337
 root@CT31337:~# apt install kali-linux-everything

This might take a while. Let the installation finish and you should have all the Kali packages available on your container.


Kali has a nice ZSH theme. You can set this up instead of the classic Debian shell.

 root@CT31337:~# apt install kali-defaults zsh zsh-syntax-highlighting zsh-autosuggestions
 root@CT31337:~# exit
 root@pve:~# pct enter 31337


Slow SSH Login

If you experience delays when logging in with SSH after enabling the kali repositories, you can enable the "nesting" option for your container.

 root@pve:~# pct set 31337 -features nesting=1 
 root@pve:~# pct reboot 31337