To install FreeBSD or CentOS as a guest operating system using KVM and virt-install
, you can use the following steps:
Download the ISO image of the desired operating system and copy it to the host machine.
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
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.
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