Create a Kali Linux VM in Proxmox

In this module, we will look at the process of creating a Kali Linux VM using the command line in Proxmox

8 months ago   •   3 min read

By 0xBEN
Table of contents

This page is part of the larger series of converting an old laptop into a bare metal home lab server. Click the link to be taken back to the original post.

Proxmox VE 7: Converting a Laptop into a Bare Metal Server
In this post, we will take a look at an in-detail process of setting up a Proxmox home lab on a bare metal server.

The point of this exercise is to use a pre-built Kali Linux VM from Offensive Security and demonstrate to you how you can:

  • Download a packaged VM using the command line
  • Extract a .VMDK file
  • Convert the .VMDK file to .QCOW2 format
  • Create a VM on the command line
  • Import and attach the .QCOW2 disk to the VM
  • Set the disk as the primary boot method

Building Kali in the Shell

Go to Under VirtualBox, right-click the download icon:

Choose copy link address. Right-click on your Proxmox node and choose shell.

Run some commands to create a Kali VM and import the disk file and use OffSec’s prebuilt Kali VM images in Proxmox'

# This is a comment. You do not need to type this in your shell.
# Initialize a variable to hold the URL copied in step 1
# Ensure the URL you're copying points to the .OVA file

# Get the filename from the URL for use later in the process
filename=$(echo $url | rev | awk -v FS='/' '{print $1}' | rev)

# Change to the /tmp directory
cd /tmp

# Make a directory for easy cleanup and move into it
mkdir kali-download && cd kali-download
# Download the VM image (may take a while)
wget $url

# Extract the contents of the .OVA file
tar -xvf $filename

# Initialize a variable to hold the name of the .VMDK file for processing
vmdkfile=$(find . -name *.vmdk)

# Replace the VMDK with QCOW2. This is the disk type that works best with Proxmox.
qcow2file=$(echo $vmdkfile | sed 's/vmdk/qcow2/g')

# Convert the .VMDK file to .QCOW2. Be patient, this command does not produce output.
# Wait for it to complete.
qemu-img convert -f vmdk -O qcow2 $vmdkfile $qcow2file

# Create a VM placeholder for Kali.
qm create 222 --memory 8192 --balloon 4096 --cores 2 --name Kali --description "Kali Linux from prebuilt image" --net0 model=virtio,bridge=vmbr1 --ostype l26 --autostart 1 --startup order=10,up=30,down=30

# Attach the disk .QCOW2 disk to the Kali VM. Wait for command to finish
# local-lvm is the default VM disk storage in my setup, yours may be different
qm importdisk 222 $qcow2file local-lvm --format qcow2

# Attach the disk
qm set 222 --scsi0 local-lvm:222/vm-222-disk-0.qcow2

# Set the disk as the primary boot
qm set 222 --boot=order=scsi0

# Clean up
cd ~
rm -rf /tmp/kali-download

Next Step: Create an OWASP Juice Shop Container

Create an OWASP Juice Shop Container in Proxmox
In this module, we will look at creating a container in our Proxmox home lab to run OWASP Juice Shop to practice our web app pentest skills

Spread the word

Keep reading