virt-install
virt-install is a command-line tool used for creating and installing virtual machines (VMs) on Linux-based systems. It is part of the libvirt suite, which provides APIs for managing various virtualization technologies. The tool allows system administrators to easily install VMs without requiring a graphical interface.
With virt-install, users can define the VM's hardware configuration, such as CPU, memory, storage, and network settings, using various command-line options. It supports a wide range of guest operating systems, including Linux, Windows, macOS, and BSD.
Users can also specify the installation media, which can be an ISO image, a network location, or a local physical or virtual disk. virt-install supports different installation methods, such as network-based installs using PXE, HTTP, or FTP servers, and image-based installs using disk files or block devices.
The tool provides options for customizing the installation process, including setting the root password, hostname, time zone, and package selection. It also supports automatic partitioning and disk encryption.
virt-install can create VMs using a variety of hypervisors, including KVM, Xen, QEMU, and VMware. It can launch the VM in a graphical or text console, or directly connect to the VM's serial or VNC console for remote management.
Users can save the VM definition as an XML file, which can be later used to clone or migrate the VM to another host. It also supports creating snapshots and managing the lifecycle of the VM.
Overall, virt-install is a powerful and flexible command-line tool that simplifies the creation and installation of virtual machines, providing system administrators granular control over the VM configuration and installation process.
List of commands for virt-install:
-
virt-install:tldr:27ec7 virt-install: Create a diskless live virtual machine without an emulated sound device or a USB controller. Don't start an installation and don't autoconnect to console but attach a cdrom to it (might be useful for when using a live CD like tails).$ virt-install --name ${vm_name} --memory ${512} --disk ${none} --controller ${type=usb,model=none} --sound ${none} --autoconsole ${none} --install ${no_install=yes} --cdrom ${path-to-tails-iso}try on your machineexplain this command
-
virt-install:tldr:3d5de virt-install: Create a x86-64, KVM-accelerated, UEFI-based virtual machine with the Q35 chipset, 4 GiB RAM, 16 GiB RAW storage, and start a Fedora installation.$ virt-install --name ${vm_name} --arch ${x86_64} --virt-type ${kvm} --machine ${q35} --boot ${uefi} --memory ${4096} --disk path=${path-to-image-raw},size=${16} --cdrom ${path-to-fedora-iso}try on your machineexplain this command
-
virt-install:tldr:58584 virt-install: Create a virtual machine and kickstart an automated deployment based on Fedora 35 using only remote resources (no ISO required).$ virt-install --name ${vm_name} --memory ${2048} --disk path=${path-to-image-qcow2},size=${20} --location=${https:--download-fedoraproject-org-pub-fedora-linux-releases-35-Everything-x86_64-os-} --extra-args=${"inst-ks=https:--path-to-valid-kickstart-org"}try on your machineexplain this command
-
virt-install:tldr:aeb8e virt-install: Create a virtual machine with 1 GB RAM and 12 GB storage and start a Debian installation.$ virt-install --name ${vm_name} --memory ${1024} --disk path=${path-to-image-qcow2},size=${12} --cdrom ${path-to-debian-iso}try on your machineexplain this command
-
virt-install:tldr:bb2e1 virt-install: Create a virtual machine with 16 GiB RAM, 250 GiB storage, 8 cores with hyperthreading, a specific CPU topology, and a CPU model that shares most features with the host CPU.$ virt-install --name ${vm_name} --cpu ${host-model},topology.sockets=${1},topology.cores=${4},topology.threads=${2} --memory ${16384} --disk path=${path-to-image-qcow2},size=${250} --cdrom ${path-to-debian-iso}try on your machineexplain this command