ks-libvirt - Man Page

Take a Fedora/CentOS/RHEL kickstart file and make a VM


ks-libvirt [options] kickstart-file

At the end of install, if the VM is not shut down with --off and the guest agent is not excluded with --noaddga, the script waits until the VM is up and an IPv4 address is configured; it will clean any previous SSH host keys for that IP and then print the IP, so if you have an SSH key defined, you can do:

ssh -l root $(ks-libvirt kickstart-file)


--addga | -a

Add qemu-guest-agent to %packages; default is to do this, use --noaddga to disable. Without the agent, the hypvervisor cannot get the IP of the VM (or do other VM management).

--anaconda | -A arguments

Additional anaconda boot arguments

--arch architecture

Use an alternate CPU architecture (this usually will require additional qemu-system-<arch> to be installed); this probably doesn't work with secureboot

--config | -C config

Config file for defaults; default is $HOME/.virtinst.cf

--cpu | -c count

VM CPU cores; default is 1

--disk | -d GB

VM disk size in gigabytes; default is 6

--disk2 GB

VM second disk size in gigabytes; default is to not use a second disk (this is mostly just useful for testing kickstart RAID handling)

--dns DNS-IPs

Set the DNS server(s) (can be specified more than once for multiple servers); default: copy host DNS config when IPv4 address is set

--dumpks | -D

Generate a modified kickstart file and dump to standard out (don't build VM)

--gw IPv4-gateway

Set the IPv4 gateway

--hostname | -h FQDN

Set the hostname; default is to not set unless network is set, then use the VM name

--ip IPv4-address/mask

Set the IPv4 address and netmask (in bits, e.g.; default is to try DHCP (if network needed)

--iso | -i ISO

ISO to boot from; default is pulled from KS or to use URL instead.  Handles a local ISO file (will be uploaded to same pool as VM storage if needed), or pool/volume for an ISO already in a storage pool.

--libvirt | -l URL

Connection to libvirt; default is $VIRTSH_DEFAULT_CONNECT_UID or qemu:///system

--machine machine

Use an alternate machine type rather than the default (e.g. q35 for x86_64)

--mapfile | -m file

URL map file to use different source repos.  The format of the file is one entry per line with a pair of URLs separated by a space.  The first URL is the original (which can be a mirrorlist or metalink) followed by a target URL to replace it with (mirrorlist/metalink are turned into direct url entries).  The default is $HOME/.virtinst-map

--name | -n name

VM name; default is KS file name minus any leading "ks-"

--net | -N interface

Bridge network interface to attach to; default is interface with default route

--off | -O

Leave the VM off at the end of install

--pool | -p pool

Storage pool name; use pool default by default

--os | -o OS

OS name, used to set VM hardware config; default is autodetect

--quiet | -q

Be very quiet - only show errors and IP at end

--ram | -r MB

VM RAM size in megabytes; default is 2048 unless specified in the KS

--screen | -s

Open the VM console screen during install

--secureboot | -B

Enable Secure Boot (implies UEFI).

--securepath [path]

Specify the path to the Secure Boot loader/NVRAM files (default is /usr/share/edk2/ovmf)

--serial | -S

Add a serial console; default is to do this, use --noserial to disable


Add found SSH key(s) to the installed system; default is to do this, use --nossh to disable


Add TPM device

--uefi | -u

Use UEFI boot instead of BIOS


Delete an existing VM with the same name before creating new (NOTE: will not ask for confirmation!)

--verbose | -v

Be more verbose

--virtinst | -V arguments

Additional virt-install arguments (can be used more than once)

Special Kickstart File Lines

The KS file is parsed for lines that look like #<tag>:<value>.  #include pulls in additional files, while the other options set default values (that can still be overridden on the command line).

Supported tags:


Include another file - this can be a full path or relative to the kickstart file itself.  HTTP/HTTPS URLs are also supported.  Includes can appear more than once, including in included files.


Number of CPU cores


RAM size in megabytes


Disk size in gigabytes


Second disk size in gigabytes


ISO file/volume to use for install

#OS:OS string

Operating system (only needed if not autodetected)


Add/don't add SSH keys


Add/don't add TPM device


Use/don't use UEFI boot


Written by Chris Adams


2024-01-25 perl v5.38.2 User Contributed Perl Documentation