1 minute read

Note: This is an RHCSA 7 exam objective.


Installing an RHEL 7 system as virtual guest requires two steps:

  • creating a Kickstart file with all the configuration parameters (ip address, disk partitioning, etc),
  • running the command for the creation itself.

Kickstart File

To create a VM called postfix.example.com (here with an IP address of, a gateway in, a DNS server in, a repository server in, Pass1234 as a password, and a total disk size of 6GB), create the file /var/www/html/conf/ks_postfix.cfg and paste the following lines:

keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
network --device=eth0 --bootproto=static --ip= --netmask= --gateway= --nameserver= --activate --ipv6=auto
network --hostname=postfix.example.com
rootpw Pass1234
timezone America/Los_Angeles --isUtc
bootloader --location=mbr --boot-drive=vda
clearpart --all --initlabel --drives=vda
ignoredisk --only-use=vda
part pv.9 --fstype="lvmpv" --ondisk=vda --size=5000
part /boot --fstype="ext4" --ondisk=vda --size=500
volgroup rhel --pesize=4096 pv.9
logvol swap  --fstype="swap" --size=500 --name=swap --vgname=rhel
logvol /  --fstype="ext4" --size=3072 --name=root --vgname=rhel



Creation Command

Run the following command:

# /bin/virt-install \
--virt-type kvm \
--name=postfix.example.com \
--disk path=/var/lib/libvirt/images/postfix.example.com.img,size=6 \
--ram=1024 \
--vcpus=1 \
--os-variant=rhel7 \
--accelerate \
--graphics vnc \
-v -l \
--network bridge:br0 \
--extra-args="console=tty0 console=ttyS0,115200 ks=

Note1: httpin the previous command can be replaced with nfs, ftp, etc. Note2: If you get this message “ERROR internal error: process exited while connecting to monitor: qemu-kvm: -chardev pty,id=charserial0: Failed to create chardev“, follow this thread. Replace “devpts /dev/pts devpts defaults 0 0” with “devpts /dev/pts devpts gid=5,mode=620 0 0” in the /etc/fstab file of the KVM host.

Additional Resources

There is a documentation about the Anaconda installer. Naftuli Tzvi Kay wrote a tutorial about using Packer to make Kickstart configuration easier. Frank Caviggia has written a script that installs a system that is configured and hardened to meet government-level regulations.

Leave a comment