Setting up a new CentOS 7 host with the help of virt-install(1) is quite easy. I’m using the following command line options:

virt-install --name=infra \
             --ram=4096 \
             --vcpu=2 \
             --os-variant=rhel6 \
             --disk path=/var/lib/libvirt/images/infra.img \
             --nographics \
             --network network=default \
             --location '' \
             --initrd-inject=/root/infra.ks \
             --extra-args='console=ttyS0,115200n8 ks=file:/infra.ks serial'

The most important option is –initrd-inject to inject your kickstart config into the initial ramdisk that virt-install is going to download when installing the host. This only works when you are using the –location option as well.

and here is the kickstart file

# System authorization information
auth --enableshadow --passalgo=sha512

# Use network installation
url --url=""


ignoredisk --only-use=vda
clearpart --drives=vda --all
part pv.01 --size 1 --grow --ondisk=vda
part /boot --fstype=ext4 --asprimary --size=512 --asprimary --ondisk=vda
volgroup rootvg pv.01
logvol /    --vgname=rootvg --size=5000 --name=rootlv
logvol /tmp --vgname=rootvg --size=512  --name=tmplv
logvol swap --vgname=rootvg --size=2048 --name=swaplv

# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'

# System language
lang en_US.UTF-8
timezone --utc Europe/Vienna

# Network information
network  --bootproto=dhcp --device=eth0 --ipv6=auto --activate
network  --hostname=localhost.localdomain

rootpw --iscrypted <your salted password hash here>


%packages --nobase
@core --nodefaults