2.1.4 Automating Installation of Oracle VM Server with a Kickstart File

The Oracle VM Server installation for x86 hardware can be automated using a Kickstart configuration file. Kickstart is well documented for Oracle Linux. You can find out more information at:

http://docs.oracle.com/cd/E37670_01/E41137/html/ol_kickstart.html

If you perform a manual installation of Oracle VM Server installation for x86 hardware, a Kickstart configuration template using the options that you selected during your install is generated automatically by the Anaconda install wizard and is available in /root/anaconda-ks.cfg. It is recommended that you perform at least one installation manually to obtain this file with the correct parameters already set for future installations.

A typical Kickstart configuration file for Oracle VM Server, as generated by Anaconda for an installation using an NFS server as the path to the ISO image file, may look similar to the following:

# Kickstart file automatically generated by anaconda.

install
nfs --server=n.n.n.n --dir=/srv/install/ovs
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --mtu=1500 --bootproto dhcp --noipv6
ovsagent --iscrypted $6$pkg8GsEJFbLPdRf6$JvBX.yJo6F9oyz1qIldIPy0bHvPpOHElZKvg3FR9DIWW07nMy/k2T5r3r
ovsmgmntif eth0
rootpw  --iscrypted $6$TO0IU.UJCLq2JZio$iJj1RPwV5wX7pD3puIUrZh1j7R2aF.cGFs6FEs2K9Py2yO3eEntR2vRKo4
# Reboot after installation
reboot
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone --utc America/Los_Angeles
bootloader --location=mbr --driveorder=sda,sdb --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=sda

part / --fstype=ext4 --grow --maxsize=51200 --size=1024
part /boot --fstype=ext4 --size=500
part swap --grow --maxsize=16128 --size=16128

# The following line is used to create an additional partition using the remaining disk space
# This partition can be used to host a local repository or provision a VM with a virtual disk 
part None --fstype=ext4 --grow --size=100

%packages
@base
@core
@ovs-virtualization

%end

The example above has marked the EULA (End User License Agreement) as Accepted. If you do this, make sure that you have read the EULA and that you agree to its terms.

Important

If you create or ammend the Kickstart configuration file, you must be certain that your changes make sense. An installation performed using Kickstart is not subject to sanity checks that usually apply to a manual installation. If something goes wrong due to a problem in a Kickstart configuration, it is unlikely that an error is returned notifying you of a problem. It is your own responsibility to check that installations performed using Kickstart complete successfully and with the correct partitioning.

If all of your servers are equivalent and you can afford to clear all partitions on the disk where you are installing Oracle VM Server, you can uncomment the partitioning information to automate this part of the installation across all of your servers. You must include a clearpart declaration and include the --drives parameter to make sure a swap partition can be created.

The following line in the kickstart configuration file indicates that the remaining disk space on the local physical disk was created as an additional partition:

part None --fstype=ext4 --grow --size=100

Remember that when installing to a server with a large number of Fibre Channel LUNs connected, the installer may take a long time to examine all storage devices. To avoid this, it is good to add a line into your Kickstart configuration to tell the Anaconda installer to ignore all other disks other than the target installation disk. For instance, you might add a line similar to the following:

ignoredisk --only-use=/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0

If you use Oracle Linux 6, which is the default base operating system for Oracle VM Server, or Fibre Channel LUNs, disk device naming and node numbering can change across reboots. This means that a local disk may not be at /dev/sda as you might have expected for each subsequent reboot. In this case, it may be better to use the UUID for a disk as found at /dev/disk/by-id, or better still, use the /dev/disk/by-path. Identifying disks by-path is more reliable when working with a number of identical machines, since it is likely that the by-id name is different for every disk. Using the by-path identifier allows you to use the same Kickstart configuration file for more than one machine. You can find out how disks are identified by running the following command as root:

# ls -lR /dev/disk

For example:

clearpart --all --drives=/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
ignoredisk --only-use=/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
part /boot --fstype=ext4 --size=100
part / --fstype ext4 --size=4096 --ondisk=/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
part swap --size=1024 --ondisk=/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
Tip

Beware of boot loader lines within a Kickstart configuration file that contain the append option console=hvc0. This option can cause the console for the server to echo your password when you log in. If you see this option in your Kickstart configuration file, remove it.

If your server has multiple network interfaces, you should at least specify the network interface to be used for the management interface first. If you have more than one network interface specified in a kickstart file, the first interface is used as the management interface. It is preferable to not include lines for any of the other network interfaces available on your server within the kickstart configuration file, as this can confuse the installer. You can configure additional network interfaces on a server within Oracle VM Manager after installation and discovery.

If you have a server with a particularly large amount of memory, you may want to edit the boot loader line to cater to these requirements. Equally, if you need to enable Huge Page support to facilitate Huge Pages for paravirtual machines, you need to edit the same line. For example, your boot loader line may be adjusted to read as follows:

bootloader --location=mbr --driveorder=sda,sdb --append="rhgb quiet allowsuperpage" --dom0_mem=1440M

If you want to enable kdump automatically during a Kickstart installation, you can add the crashkernel=auto directive to the append options listed in the bootloader line:

bootloader --location=mbr --driveorder=sda,sdb --append="rhgb quiet crashkernel=auto" --dom0_mem=1440M

Although the Xen hypervisor does not recognize this directive specified in this way, the installer detects this as a flag to enable and configure kdump. The installer automatically calculates appropriate memory and offset values to reserve for the crash kernel and appends the correct information to the GRUB 2 configuration. See Diagnostic Tools for Oracle VM Server in the Oracle VM Administration Guide guide for more information on installing and configuring kdump.

Several other options may be appended to the bootloader line depending on your environment requirements. See Section 5.7, “Finalizing Upgrades on Oracle VM Server for x86” for more information on the other options that you may want to append here.

There are numerous options available for use in a Kickstart configuration file. The file generated by Anaconda after it has successfully completed the installation should be sufficient for use to automate the installation process on other systems, unless you need to provide different partitioning information for each system. In this case, you may need to create and maintain a separate Kickstart file for each system.

It is possible to create a %post division in your Kickstart configuration file for the purpose of automating some actions after the install has completed, but before the server has rebooted. This can prove useful if you need to perform additional tasks, such as copying SSH keys from a location accessible to the server, or for triggering a change to a PXELinux configuration parameter to prevent an install loop as discussed in Section 3.1, “Installing Oracle VM Server for x86 from PXE Boot”.