Up until recently, I was doing all my unattended installs to provision linux guests with a kickstart hosted over http. Now, with this neat flag ‘–initrd-inject‘ in virt-install , guests can be created using a local kickstart file. This is available in python-virtinst-0.500.4-1 and above)
Here is the invocation, it assumes network bridging is configured. Refer this to quickly configure bridging (if you haven’t already).
This creates a minimal guest w/ these specs: 20G disk image(RAW format); 2GB ram ; 2 Virtual CPUs.
#!/bin/bash set -x # Note: Replace this with your local Fedora tree if you have one. tree= http://download.fedoraproject.org/pub/fedora/linux/releases/15/Everything/x86_64/os virt-install --connect=qemu:///system \ --network=bridge:br0 \ --initrd-inject=/export/fed-minimal.ks \ --extra-args="ks=file:/fed-minimal.ks \ console=tty0 console=ttyS0,115200" \ --name=f15testbox \ --disk /var/lib/libvirt/images/f15testbox.img,size=20 \ --ram 2048 \ --vcpus=2 \ --check-cpu \ --accelerate \ --hvm \ --location=$tree \ --nographics
Also a serial console(ttyS0) is configured so that all the booting/package-install process(complete install should take around around 4-5 mins) could be seen from the shell.
Later on, for remote management using libvirt, you can connect to guests using:
$ virsh console f15testbox
And the contents of the kickstart file ‘fed-minimal.ks’. This is the smallest possible install:
# Minimal Kickstart file install text reboot lang en_US.UTF-8 keyboard us network --bootproto dhcp #Choose a saner password here. rootpw testpasswd firewall --enabled --ssh selinux --enforcing timezone --utc America/New_York #firstboot --disable bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" zerombr clearpart --all --initlabel autopart #Just core packages %packages @core %end
I placed all the above in a quick script
A note on bridging, network device names:
With the recent Fedora 15 feature Consistent Network Device Naming , network device names from here on would be renamed from ethX to something like emX . Refer the Fedora test day for more information and a script to determine if your system is impacted due to the Biosdevname change. (I had to do this for my DELL optiplex Xeon test box.)