< Previous | Contents | Next >
1.3. virt-install
virt-install is part of the virtinst package. To install it, from a terminal prompt enter:
sudo apt install virtinst
There are several options available when using virt-install. For example:
sudo virt-install -n web_devel -r 512 \
--disk path=/var/lib/libvirt/images/web_devel.img,bus=virtio,size=4 -c \ ubuntu-18.04-server-i386.iso --network network=default,model=virtio \
--graphics vnc,listen=0.0.0.0 --noautoconsole -v
• -n web_devel: the name of the new virtual machine will be web_devel in this example.
• -r 512: specifies the amount of memory the virtual machine will use in megabytes.
• --disk path=/var/lib/libvirt/images/web_devel.img,size=4: indicates the path to the virtual disk which can be a file, partition, or logical volume. In this example a file named web_devel.img in the /var/lib/libvirt/ images/ directory, with a size of 4 gigabytes, and using virtio for the disk bus.
• -c ubuntu-18.04-server-i386.iso: file to be used as a virtual CDROM. The file can be either an ISO file or the path to the host's CDROM device.
• --network provides details related to the VM's network interface. Here the default network is used, and the interface model is configured for virtio.
• --graphics vnc,listen=0.0.0.0: exports the guest's virtual console using VNC and on all host interfaces. Typically servers have no GUI, so another GUI based computer on the Local Area Network (LAN) can connect via VNC to complete the installation.
• --noautoconsole: will not automatically connect to the virtual machine's console.
• -v: creates a fully virtualized guest.
After launching virt-install you can connect to the virtual machine's console either locally using a GUI (if your server has a GUI), or via a remote VNC client from a GUI-based computer.
1 https://help.ubuntu.com/18.04/installation-guide/