KVM virt-install: Install FreeBSD / CentOS As Guest Operating System

ww‮tual.w‬turi.com
KVM virt-install: Install FreeBSD / CentOS As Guest Operating System

To install FreeBSD or CentOS as a guest operating system using KVM and virt-install, you can use the following steps:

  1. Download the ISO image of the desired operating system and copy it to the host machine.

  2. Install the virt-install and libguestfs-tools packages on the host machine by running the following command:

sudo apt-get install virt-install libguestfs-tools
  1. Create a new virtual machine using the virt-install command. For example, to create a new virtual machine with 2 CPU cores, 4GB of RAM, and a 20GB disk, you can use the following command:
virt-install --name=centos7 --memory=4096 --vcpus=2 --disk path=/var/lib/libvirt/images/centos7.img,size=20 --cdrom=/path/to/centos7.iso --network bridge=br0 --graphics vnc --os-type=linux --os-variant=centos7.0 --noautoconsole

Replace centos7 with the desired name for the virtual machine, and /path/to/centos7.iso with the path to the ISO image on the host machine.

  1. Follow the prompts to complete the installation of the guest operating system.

To install FreeBSD as a guest operating system, you can use a similar command, but specify the --os-type=freebsd option and the appropriate --os-variant value. For example:

virt-install --name=freebsd --memory=4096 --vcpus=2 --disk path=/var/lib/libvirt/images/freebsd.img,size=20 --cdrom=/path/to/freebsd.iso --network bridge=br0 --graphics vnc --os-type=freebsd --os-variant=freebsd11.0 --noautoconsole
Created Time:2017-10-29 22:08:50  Author:lautturi