Fast path to a running guest - virt-install
With a single virt-install command, configure and define a virtual server, and install and run a guest.
- You need a source for your guest installation. The source can be an ISO file in the host file system, or a Web location that provides the installation files.
- Ensure that virt-install is available. Depending on your distribution, the
package name for this tool might be
virtinst
orvirt-install
. - Use virt-xml to run a transient guest without defining a virtual server that persists beyond the guest shutdown.
The sections that follow show basic examples for running a virt-install command. See the man page for more options.
Installing from an ISO file
# virt-install --name=<vs_name> --disk size=<disk_size_in_GB> --memory=<vs_memory_size_in_MB> \
--cdrom <filepath_to_iso>In
the command:- <vs_name>
- is the name of the virtual server to be created.
- <disk_size_in_GB>
- is the size, in GB, of the virtual disk on which the guest is to be installed. The disk is backed by an image file in the file system of the host.
- <vs_memory_size_in_MB>
- is the size, in MB, of the memory of the virtual server to be created.
- <filepath_to_iso>
- is the file path to the ISO file in the host file system. During the installation, the file is accessed through a virtual DVD drive.
The virt-install tool defines the virtual server. It then starts the virtual server, boots the specified ISO image with the installer, and displays the installation dialog on the console. Follow the instructions to complete the installation.
When the installation is completed the guest is rebooted from the virtual disk where it is installed. You do not need to edit the domain configuration-XML file. virt-install makes the required post-installation changes for you.
# virt-install --name=a_server --disk size=10 --memory=1000 \
--cdrom /var/lib/libvirt/images/linux-s390x.iso
Installing from a network location
# virt-install --name=<vs_name> --disk size=<disk_size_in_GB> --memory=<vs_memory_size_in_MB> \
--location <url>In
the command <url> specifies a download site and protocol. See the
virt-install man page for examples of download sites for some of the major
distributions.The other variables have the same meaning as in Installing from an ISO file.
# virt-install --name=b_server --disk size=10 --memory=1000 \
--location https://download.fedoraproject.org/pub/fedora-secondary/releases/28/Server/s390x/os/
The virt-install tool defines the virtual server. It then starts the virtual server, boots the installer, and displays the installation dialog on the console.
# virt-install --name=b_server --disk size=10 --memory=1000 \
--location https://download.fedoraproject.org/pub/fedora-secondary/releases/28/Server/s390x/os/ \
--extra-args inst.ks=file:///f28.ks --initrd-inject=f28.ks
When the installation is completed the guest is rebooted from the virtual disk where it is installed. You do not need to edit the domain configuration-XML file. virt-install makes the required post-installation changes for you.
Customizing your virtual server
Edit the domain configuration-XML file to customize the virtual server according to your needs.