Customizing the Kickstart Configuration File

The Kickstart configuration file consists of installation instructions in the form of options and parameter definitions.

To create a Kickstart configuration file, choose one of the following methods:

  • Use the /root/anaconda-ks.cfg file of an existing Oracle Linux system.

    Every Oracle Linux installation creates a file called /root/anaconda-ks.cfg. The file contains configuration definitions based on the system on which Oracle Linux is installed and which can be read by Kickstart. Thus, the file is ready to be used either as is for other installations, or as a template for automating various types of installations for specific target systems.

    As a template, the file's contents need to be revised to be applicable to other Oracle Linux installations, such as which OS versions to install on specific clients.

    If the system contains the pykickstart package, the following useful tools can help you with revising the file's contents:

    • ksverdiff identifies removed or deprecated options.

    • ksvalidator checks that the syntax in the file is correct.

  • Install an Oracle Linux release manually, which generates the /root/anaconda-ks.cfg file. Use the file to automatically install the same Oracle Linux release on other clients. You might need to adjust some configuration options in the file depending on the specifications you want to apply to those clients.

For more information, see https://pykickstart.readthedocs.io/en/latest/.

The configuration file is divided into parts. Each part contains a group of options as follows:

Installation Options

Installation options define parameters for system storage, keyboard definitions, language setting, network information, and so on. In the following example, the option definition in bold enables PXE to bring up the network interface and is important in network installations.

Note:

To use the Btrfs file system that's supported in UEK, ensure that you're using the UEK installation media as described in Btrfs installation chapter. Then you can use the autopart Kickstart option to automatically partition disks using Btrfs, as shown in the following example under # Partition Information.

If you're using local mirror repositories, ensure that these are current and that the Kickstart configuration includes the UEK repository required for Btfrs to function. Either use the Oracle Linux yum server to mirror the required repositories; or if you're unable to access the Oracle Linux yum server, you can mirror the repositories included on the full installation ISO, but you must use the UEK installation ISO to boot the installer. In the following example, the system is assumed to have access to the Internet and the publicly available Oracle Linux yum server repositories are used directly.

Alternatively, you also manually partition the disks to use Btrfs as described in the upstream documentation.

#platform=x86, AMD64, or Intel EM64T
#version=OL8
# Firewall configuration
firewall --enabled --service=ssh
      
# Install OS instead of upgrade
install
      
# Use Oracle Linux yum server repositories as installation source
repo --name="ol8_AppStream" --baseurl="https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/"
repo --name="ol8_UEKR7" --baseurl="https://yum.oracle.com/repo/OracleLinux/OL8/UEKR7/x86_64/"
url --url="https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64"
      
# Root password
rootpw --iscrypted SHA512_password_hash
      
# Use graphical install
graphical
firstboot --disable
      
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
      
# System language
lang en_US.UTF-8
      
# SELinux configuration
selinux --enforcing
      
# Installation logging level
logging --level=info
      
# System timezone
timezone  America/Los_Angeles
      
# Network information
network  --bootproto=dhcp --device=em1 --onboot=yes --hostname=hostname
      
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
      
# Non-administrative user
user --name=user --homedir=/home/user --password=SHA512_password_hash --iscrypted
      
# Partition information
clearpart --all --initlabel --drives=sda
autopart --type=btrfs

Packages to Install

Packages to be installed are listed under the group heading %packages. The list is stops at the %end line.

%packages
@base
@core
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@multimedia
@print-client
@print-server
@x11
mtools
pax
python-dmidecode
oddjob
wodim
sgpio
genisoimage
device-mapper-persistent-data
abrt-gui
samba-winbind
certmonger
openldap-clients
pam_krb5
krb5-workstation
ldapjdk
slapi-nis
libXmu
perl-DBD-SQLite
perl-Mozilla-LDAP
%end

The list includes package groups and individual packages. Names of package groups use the @ prefix, such as @base, to distinguish them from individual packages.

To help decide which packages to include in the file, use the dnf group list command on an existing Oracle Linux server. The command displays both the installed package groups and the package groups that are available to install.

To specify more than one package for a match, you can use the wildcard character (*). To exclude a package from the installation, insert the - character as a prefix to the package name.

The %packages keyword can take options, such as the following useful ones.

--ignoremissing

Installs the available packages without prompting about missing packages. Without this option, Kickstart would interrupt the installation and prompt you to continue or cancel the installation.

--multilib

Sets the multilib policy in dnf configuration to all so that 32-bit packages can be installed on the system.

Instead of listing packages directly into the configuration file, you can compile these names into a file and store it in an accessible location, such as locally in a Kickstart's ramdisk file system, or on an HTTP server or an NFS share. Then on the configuration file, specify the full path to the list in an %include statement, for example:

%packages --ignoremissing
%include /tmp/package-list
%end

Preinstallation Options

Preinstallation options define the actions that the installer must perform before beginning the installation process. Configuring this group of options is optional. The options are under the %pre heading and terminated by the %end line.

In the following example, the installer is instructed to run the script config-partitions that is stored on an HTTP server. Further, the installer should also download a list of packages from the web server for use with a %include /tmp/package-list statement in the %packages section.

%pre
%include http://192.168.1.100/scripts/config-partitions
wget -q -O- http://192.168.1.100/scripts/package-list > /tmp/package-list
%end

In this example, the wget command saves the package list in Kickstart's file system, which exists as a ramdisk in memory.

An included script or file must be accessible at the specified path or URL. If no name service is available to identify hosts, then use IP addresses.

Postinstallation Options

Postinstallation options define any actions to be completed by the installer at the end of the installation. Configuring this group of options is optional.

The options are under the %post heading and terminated by the %end line.

By default, Kickstart runs postinstallation tasks in a chroot environment that's based on the root file system of the newly installed system. If you need to access any files that are outside the chroot environment, specify the --nochroot option to %post line. You can then access files in the Kickstart file system with the newly installed system's root file system being mounted at /mnt/sysimage.

In the following example, the script /tmp/post-config is run at the end of the installation.

%post --nochroot
%include /tmp/post-config
%end

If you configure the installed system's network interface to obtain its settings using DHCP, you must either use IP addresses instead of domain names or set up a temporary resolv.conf file, for example:

%post
wget -q -O- http://192.168.1.100/scripts/resolv.conf > /etc/resolv.conf
%include http://instsvr.example.com/scripts/post-config
.
.
.
%end