# Virtualization It is realy easy to virtualize an operating system with OpenBSD thanks to vmd. > Well, that's nice, but what virtualizing means ? Instead of installing different OS on different computers, you can install an OS inside your current OS. The virtualizer fake to be a full device and run an OS installed on a disk, which is in this case a simple file. It is very handy since : * You can use multiple system simultaneously. * Each system is independent. If one is compromised, others should be safe. It's better than a chroot. * Backup is really easy: just copy the disk file. * It's great to try things. However, it require more resources. Before going further, make sure we use the same vocabulary : * "host" is your server. The host virtualize other systems. * "client" are hosted systems. OpenBSD offer 3 tools for virtualization : * vmd : a daemon to manage multiple clients. * vmctl : To control clients and sending commands to vmd. * vmm : To watch over clients. ## How to virtualize OpenBSD ? Actually, everything is already well documented on OpenBSD's website. This chapter will just focus on a few tips. You should definitely read OpenBSD's FAQ on this topic 😉. => https://www.openbsd.org/faq/faq16.html ## Virtualize debian Like most linux distro, you'll have to set the installer and bootloader to start the client with a serial console at speed 15200. ``` # download debian image ftp "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.5.0-amd64-netinst.iso" # create disk vmctl create -s 50G /var/vm/debian.qcow2 # start the VM vmctl start -c -m 1G -L -i 1 -r debian*.iso -d /var/vm/debian.qcow2 debianvm ``` Choose install menu without validating ⚠. Press TAB then edit the line to change vga and console parameters: ``` /install.amd/vmlinuz vga=off initrd=/install.amd/initrd.gz --- quiet console=ttyS0,115200n8 ``` Press Enter. After installing and rebooting on the fresh debian install, edit /etc/default/grub so serial console is still used. ``` GRUB_TIMEOUT=1 GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0,115200" GRUB_TERMINAL="console serial" GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1" ``` Then reload grub: ``` # update-grub ``` ## Virtualize Alpine Linux Alpine Linux is a very light distro. => https://www.alpinelinux.org/ Here again, you need to boot using serial console. ``` # vmctl create -s 50G /var/vm/linux.qcow2 # vmctl start -c -m 1G -L -i 1 -r image.iso -d /var/vm/linux.qcow2 linux ``` When starting virual machine, press "TAB" to see available image (i.e. "lts" or "virt"). Add appropriate parameter to use serial console (facultative): ``` virt console=ttyS0,115200 ``` Then press Enter and it's all good. --- => ../ Table of contents => /thanks/ Donate