KVM virt-install: Install FreeBSD / CentOS As Guest Operating System
virt-install is a command-line tool used to create virtual machines in KVM. Here are the steps to install FreeBSD or CentOS as a guest operating system using virt-install:
- Open a terminal window on your KVM host machine.
- Type the following command to start the installation process:
virt-install \ --name guest_name \ --memory 2048 \ --vcpus 2 \ --disk size=20 \ --location ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/11.1-RELEASE \ --os-type=freebsd \ --os-variant=freebsd11.1 \ --graphics vnc \ --console pty,target_type=serialReplace
guest_namewith the name you want to give the virtual machine.In this example, we are installing FreeBSD 11.1 as a guest operating system. If you want to install CentOS, replace the
--locationparameter with the URL of a CentOS ISO file. - Press Enter to execute the command. The installation process will start, and you will see output similar to the following:
Starting install... nRetrieving file .treeinfo... nRetrieving file MANIFEST... nRetrieving file base.txz...This step will take some time as it downloads the required packages.
- Follow the prompts to complete the installation process. When prompted, select the disk to install the operating system to, and configure any other settings as necessary.
- Once the installation is complete, you can connect to the virtual machine using VNC. To do this, type the following command:
virsh console guest_nameReplace
guest_namewith the name of the virtual machine that you created.This will open a console window for the virtual machine, allowing you to access its command line interface.
That’s it! You have successfully installed FreeBSD or CentOS as a guest operating system using virt-install. You can use the same basic steps to install other operating systems as well. (sullivansusa.net)
