Kickstart Made Easy With Oracle VM and Xen

What if you could use Kickstart with Oracle VM without DHCP nor a customized ISO?
Creating Oracle Linux Guests on Oracle VM for x86 is kind of fun considering the number of options you have. You can clone an existing VM and download a template from Oracle Software eDelivery Cloud[1]. You can also start the VM in HVM mode and install it from the DVD. You can obviously use Kickstart. You can build your own templates offline. You can use OVF[2] files made with other hypervisors like Virtualbox or VMWare. You can get it from a physical or virtual server with the physical-to-virtual conversion tool.
Kickstart is probably the most powerful, the most flexible and the fastest method to install RPM-based Linux systems like Oracle Linux. When used with VMs, it allows to provision guests in a time-span ranging from 2 to 10 minutes, depending on the amount of RPMs you install, your network and how deep you want to go into customizing your guests. More important, once kicked off, you can make it in a way that it doesn’t require any user input at all. There is one concern though, Kickstart usually requires you to burn ISOs or to rely on a DHCP server customized to manage PXE boot. Obviously there are management tools[4][5] to make the process simple, but still…
Oracle VM and Xen Hypervisor 4.2+ allow you to directly boot and install a paravirtualized guest with a static network and a kickstart configuration file. This is what Oracle VM xenpvboot script does behind the scene. Oracle’s Zhigang Wang has made it available in Xen 4.2 as xenpvnetboot[6]. This article shows how things become simple when you use this method

Kickstart Configuration File

To demonstrate this feature, you need a Kickstart configuration file like the demo.cfg file below. This file is not specific to your guest and can be used for several VMs. Let’s say it is available from http://yum.easyteam.fr/templates/demo.cfg in this example, even if you can not reach this url yourself:

cat demo.cfg
# Demo Only KickStart File
#    - Packages are not up-to-date
#    - Packages are missing
#    - Highly unsecured
# System Configuration and Installation
firewall --disabled
install
url --url="http://yum.easyteam.fr/DVD"
rootpw --iscrypted $1$gguQYHju$9Xq7w61deFUfZ3wLQNJqM1
auth  --useshadow  --passalgo=sha512
text
keyboard fr
lang en_US
selinux --disabled
skipx
logging --level=info
halt
timezone  Europe/Paris
# Network
# -- no need, it’s given as parameter
# Storage Configuration
bootloader --location=mbr
zerombr
clearpart --all
part /boot --asprimary --fstype="ext3" --size=500
part pv.008002 --grow --size=1
volgroup vg_sys --pesize=4096 pv.008002
logvol / --fstype=ext4 --name=lv_root --vgname=vg_sys --grow --size=1
logvol swap --name=lv_swap --vgname=vg_sys --size=4096
%packages --nobase
@core
%end

Note 1:
This demo.cfg file relies on the Oracle Linux 6 ISO published on http://yum.easyteam.fr/DVD a fake url that you cannot reach either. It is provided for demonstration purpose only and has several security concerns: it doesn’t include software patches; the root password is manager;

Note 2:
Once installed the server will be automatically stopped so that you can change its boot loader from xenpv(net)boot to pygrub.

Dom-U configuration files

In order to create a Dom-U with Kickstart and a static network, you will need to review Linux/Anaconda boot parameters[3] and create a configuration file for a paravirtualized guest with the 2 following options:

bootloader='/usr/bin/xenpvboot'
bootargs='--args="ksdevice=eth0 network bootproto=static ip=192.168.0.108 netmask=255.255.255.0 gateway=192.168.0.1 dns=192.168.0.1 hostname=marvel.easyteam.fr ks=http://yum.easyteam.fr/templates/demo.cfg" http://yum.easyteam.fr/DVD/'

From a Xen 4.2+ server, you should reference the bootloader with its arguments too. bootargs syntax is slightly different and require the –location parameter to reference your RPM repository:

bootloader='/usr/lib64/xen/bin/xenpvnetboot'
bootargs='--args="ksdevice=eth0 network bootproto=static ip=192.168.0.108 netmask=255.255.255.0 gateway=192.168.0.1 dns=192.168.0.1 hostname=marvel.easyteam.fr ks=http://yum.easyteam.fr/templates/demo.cfg" --location http://yum.easyteam.fr/DVD/'

Oracle VM Manager Configuration

As you know, you are not supposed to modify Dom-U configuration file manually on an Oracle VM host. Fortunately, the Oracle VM Manager console fully implements that feature. When you create a paravirtualized guest, the « Boot Order » tab shows the « Network » bootloader that stands for xenpvboot; « Network Boot Path » stands for the bootloader arguments. In order to use this method from the Manager, select the boot options as below and fill in the Network Boot Path with the content of the bootargs parameter:
xenpvboot
Assuming you’ve created the right resources for the VM (disk and network card), you should be able install your guest by kicking it off.

Note:
Once the VM started and installed, it automatically shuts down; resets the boot option to “Disk” (aka pygrub) and restarts the VM to run it from the installed guest.

What comes Next?

Kickstart is by far the most flexible method to automate Oracle Linux 6 installations. Oracle VM/xenpvboot and Xen 4.2+/xenpvnetboot make the triggering of kickstart as well as the configuration of the primary network straight forward. Provisioning VMs has never been simpler, faster and more accurate.
As you’ve figured out in the previous article, Oracle Software can also easily be packaged in RPMs. Once you’ve been able to automate provisioning, you should now focus on:

  • automating VM provisioning from scripts and APIs
  • manage application provisioning and configuration

In forthcoming articles, this blog will demonstrate some of those operations.
Bibliography
[1] Oracle Software Delivery Cloud – Oracle Linux and Oracle VM
[2] Open Virtualization Format Standard
[3] Red Hat Enterprise Linux 6- Installation Guide – Chapter 28. Boot Options
[4] Cobbler website
[5] Spacewalk website
[6] xenpvnetboot on wiki.xen.org