KVM virt-install: Install OpenBSD As Guest Operating System

last updated in Categories , , , ,

How do I install OpenBSD as guest operating system when using KVM? How can I use virt-install to setup OpenBSD VM under KVM running on a CentOS Linux 7 server?

OpenBSD is a UNIX like system based on Berkeley Software Distribution (BSD). It was forked form NetBSD and created by Theo de Raadt in 1995. OpenBSD is famous for quality code and documentation without compromising position on software licensing. OpenBSD is also well know for focus on security features such as Memory protection, cryptography, randomization and much more in default base installation. This page shows how to use the virt-install command line tool of KVM to setup OpenBSD guest VM.

How to install OpenBSD as guest operating system when using KVM

You need to first download OpenBSD iso image by visiting this page. You can use the wget command or lftp command or curl command to grab the ISO image as follows. The following command will download OpenBSD v6.3 64 bit (AMD64) iso file on a CentOS 7 or Ubuntu 18.4/16.04 LTS or Debian Linux 9.x server:
# cd /var/lib/libvirt/boot/
# wget https://cloudflare.cdn.openbsd.org/pub/OpenBSD/6.3/amd64/install63.iso
# wget https://cloudflare.cdn.openbsd.org/pub/OpenBSD/6.3/amd64/SHA256
# chown qemu:qemu install63.iso

Verify SHA256 (256-bit) checksums for install63.iso:
# grep install63.iso SHA256 > /tmp/x
# sha256sum -c /tmp/x
# rm /tmp/x

Download OpenBSD 6.3 and verify it with sha256sum command on Linux

Install OpenBSD 6.3 AMD64 VM on Linux KVM

Type the following command to install OpenBSD 6.3 64 bit with minimum 2GB RAM, 2 vcpu, 40GB disk space, and virbr0 network interface:
# virt-install \
--name=openbsd \
--virt-type=kvm \
--memory=2048,maxmemory=4096 \
--vcpus=2,maxvcpus=4 \
--cpu host \
--os-variant=openbsd5.8 \
--cdrom=/var/lib/libvirt/boot/install63.iso \
--network=bridge=virbr0,model=virtio \
--graphics=vnc \
--disk path=/var/lib/libvirt/images/openbsd.qcow2,size=40,bus=virtio,format=qcow2

Sample outputs:

Starting install...
Allocating 'openbsd.qcow2'                                                                                                                                                                  |  40 GB  00:00:00     
Domain installation still in progress. Waiting for installation to complete.

Use your local vnc viewer or type the following at server itself to view installer screen:
# vncviewer
To configure vnc login from another terminal over ssh and type:
# virsh dumpxml openbsd | grep vnc
<graphics type='vnc' port='5903' autoport='yes' listen=''>

Please note down the port value (i.e. 5903). You need to use an SSH client to setup tunnel and a VNC client to access the remote vnc server. Type the following SSH port forwarding command from your client/desktop:
$ ssh vivek@server1.cyberciti.biz -L 5903:
Once you have ssh tunnel established, you can point your VNC client at your own (localhost) address and port 5903 to continue with OpenBSD 6.3 installation:
Install OpenBSD As Guest Operating System On Linux When Using virt-install
Now, just follow on screen installation instructions and install OpenBSD as per your requirements:

(HTML5 Video 01: Click to play)

Make sure OpenBSD vm starts when Linux KVM box restarts

# virsh autostart openbsd

After Reboot My OpenBSD Guest Hangs At The Boot Screen…

Optional: Configure Serial Console Login and Redirection

This entry is 12 of 14 in the CentOS / Redhat (RHEL) KVM Virtulization series. Keep reading the rest of the series:
  1. CentOS / Redhat: Install KVM Virtualization Software
  2. CentOS / Redhat: KVM Bridged Network Configuration
  3. KVM virt-manager: Install CentOS As Guest Operating System
  4. KVM virt-install: Install FreeBSD / CentOS As Guest Operating System
  5. KVM: Install CentOS / RHEL Using Kickstart File (Automated Installation)
  6. Troubleshooting KVM Virtualization Problem With Log Files
  7. KVM Virsh: Redirect FreeBSD Console To A Serial Port
  8. KVM: Starting / Stopping Guest Operating Systems With virsh Command
  9. Linux KVM: Disable virbr0 NAT Interface
  10. FreeBSD / OpeBSD Running in KVM Does Not Accept FTP Traffic
  11. KVM: Start a Virtual Machine / Guest At Boot Time
  12. KVM virt-install: Install OpenBSD As Guest Operating System
  13. Linux KVM: OpenBSD Guest Hangs At Starting tty Flags
  14. KVM Virtualization: Start VNC Remote Access For Guest Operating Systems

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive

1 comment

    Have a question? Post it on our forum!