Skip to content

Installation Guide

a5traa edited this page Jun 17, 2025 · 8 revisions

Installation Guide ‐ Victim VM

1. Create the virtual disk image

qemu-img create -f qcow2 config/ubuntu-victim.qcow2 20G

2. Download the .iso

wget -O ./config/ubuntu-24.04.iso https://releases.ubuntu.com/noble/ubuntu-24.04.2-desktop-amd64.iso

3. Start the Ubuntu installer in QEMU

qemu-system-x86_64 \                                                
  -enable-kvm \
  -m 8192 \
  -cpu host \
  -smp cores=4,threads=1,sockets=1 \
  -drive file=config/ubuntu-victim.qcow2,format=qcow2,if=virtio \
  -cdrom config/ubuntu-24.04.iso \            
  -boot d \ 
  -name "Ubuntu-Victim-Install"

4. Follow the installation steps

5. Turn off the VM and go back in your terminal

6. Reboot the installed VM (without ISO)

qemu-system-x86_64 \                                                
  -enable-kvm \
  -m 8192 \
  -cpu host \
  -smp cores=4,threads=1,sockets=1 \
  -drive file=config/ubuntu-victim.qcow2,format=qcow2,if=virtio \
  -virtfs local,path=.,mount_tag=shared,security_model=mapped-xattr \
  -vga qxl \
  -name "Ubuntu-Victim"

7. Log into your user session

8. Mount a shared folder

sudo mkdir /mnt/shared
sudo mount -t 9p -o trans=virtio,version=9p2000.L shared /mnt/shared
cd /mnt/shared

9. Install required packets

sudo chmod +x ./config/init.sh
./config/init.sh

10. (Optional) Create a QEMU alias

To avoid typing the entire QEMU command every time, you can create a permanent alias for quicker access.

Open your shell configuration file

nano ~/.bashrc

Add alias at the end of the file

alias run-victim='qemu-system-x86_64 \
  -enable-kvm \
  -m 8192 \
  -cpu host \
  -smp cores=4,threads=1,sockets=1 \
  -drive file=config/ubuntu-victim.qcow2,format=qcow2,if=virtio \
  -virtfs local,path=.,mount_tag=shared,security_model=mapped-xattr \
  -vga qxl \
  -name "Ubuntu-Victim"'

Save and exit, then source the configuration file

source ~/.bashrc

Now, you can start the VM easily with

run-victim