Skip to content

Virtualization

GradedJestRisk edited this page Nov 23, 2023 · 2 revisions

Docker

[https://github.com/GradedJestRisk/cicd-training/wiki/Docker Docker]

Virtualbox

Steps:

  • install virtualbox
  • install kernel images: sudo apt install --reinstall linux-headers-$(uname -r) virtualbox-dkms dkms

Check UEFI is enabled:

  • install UEFI boot manager: sudo apt install efibootmgr
  • load it: sudo efibootmgr
  • you should NOT get EFI variables not supported, but something like
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0000,0004,0001,0002,0005,0003

Then:

  • download image: [https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ IE on Windows]
  • import in Virtualbox (File/import appliance)
  • start
  • if you get this error message Kernel driver not installed (rc=-1908), go on:
    • run sudo modprobe vboxdrv
    • if you get modprobe: ERROR: could not insert 'vboxdrv': Operation not permitted, then disable UEFI secure boot in BIOS - Here for HP

LXC/LXD

Source

Source

Install

snap install lxd
# https://linuxcontainers.org/lxc/getting-started/
sudo apt-get install lxc
lxc-checkconfig
sudo snap install distrobuilder --classic
sudo apt-get install wimtools
sudo apt-get install libwin-hivex-perl
sudo apt-get install virt-viewer
sudo apt-get install virt-viewer

Create VM

export VM=windows11
lxc stop --force $VM
lxc delete $VM
lxc init $VM --vm --empty
# Add enough disk space
lxc config device override $VM root size=60GiB
# Setup RAM and CPU
lxc config set $VM limits.cpu=4 limits.memory=8GiB
# Trusted Platform Module - For Windows
lxc config device add $VM vtpm tpm path=/dev/tpm0

Create installation ISO

export SOURCE_ISO_FILE=Win11_22H2_English_x64v2.iso
export TARGET_ISO_FILE=win11.lxd.iso
cd ~/Downloads
sudo distrobuilder repack-windows $SOURCE_ISO_FILE $TARGET_ISO_FILE

Mount ISO to VM

The ISO will be mounted as CDROM with highest boot priority

lxc config device add $VM install disk source=<PATH-TO-ISO> boot.priority=10

Start VM to install OS

lxc start $VM --console=vga
# Press a key to start from CDROM
# If you're not quick enough, boot will go on over network (PXE)

Interact with container

You can connect to a running container

lxc list
lxc console $VM --type=vga
lxc config device add $VM eth1 nic name=eth1 nictype=bridged parent=lxdbr0
# get logs
lxc info --show-log $VM

# stop it forcefully
lxc stop --force $VM

# check configuration
lxc config show --expanded $VM

Network

https://documentation.ubuntu.com/lxd/en/latest/howto/network_create/ https://wiki.debian.org/LXC#Networking_Essentials

# Check default = here lxcbr0 LXC bridge 0
> cat /etc/lxc/default.conf
#lxc.net.0.type = veth
#lxc.net.0.link = lxcbr0

# Check available
lxc network list

# Check used

QubeOS

https://www.qubes-os.org/doc/installation-guide/

https://forum.qubes-os.org/t/how-do-i-install-windows/12769

Boxes

https://www.ctrl.blog/entry/how-to-win11-in-gnome-boxes.html

Clone this wiki locally