Customizing the Kickstart Configuration File
The Kickstart configuration file consists of installation instructions in the form of options and and any required parameters.
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, which can be read by Kickstart. The file can be used, unmodified, to repeat the installation, or as a template that can be customized to apply 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 with customization:-
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 installation requirements of 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 lets PXE bring up the network interface and is important in network installations. It also shows how to specify using the Btrfs file system, which is available in UEK.
Note:
To use the Btrfs file system that's available in UEK, ensure that you're using the UEK
installation media as described in Installing a System with a Btrfs root file system. 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 Internet access and uses the publicly available Oracle Linux yum server repositories directly.
Or you can partition the disks to use Btrfs manually, as described in the upstream documentation.
#platform=x86, AMD64, or Intel EM64T
#version=OL10
# Firewall configuration
firewall --enabled --service=ssh
# Use Oracle Linux yum server repositories as installation source
repo --name="ol10_AppStream" --baseurl="https://yum.oracle.com/repo/OracleLinux/OL10/appstream/x86_64/"
url --url="https://yum.oracle.com/repo/OracleLinux/OL10/baseos/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
logging
# 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 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 indnf
configuration toall
so that 32-bit packages can be installed on the system.
Instead of listing packages directly in the configuration file, you can compile these names
into a separate 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 in the configuration file,
specify the full path to this secondary file in an %include
statement, for
example:
%packages --ignoremissing
%include /tmp/package-list
%end
Preinstallation Options
Preinstallation options define any actions that the installer must perform before beginning
the installation process. These options are specified under the %pre
heading
and ended by the %end
line. This section isn't mandatory.
In the following example, the installer is instructed to run the script
config-partitions
that's stored on an HTTP server. It then downloads a list
of packages from the web server for use with a %include /tmp/package-list
statement in the %packages
section. The wget
command saves
the package list in Kickstart's file system, which exists as a ramdisk in memory.
%pre
%include http://server-ip-address/scripts/config-partitions
wget -q -O- http://server-ip-address/scripts/package-list > /tmp/package-list
%end
Any 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. This section isn't mandatory.
These options are specified under the %post
heading and ended by the
%end
line.
The root
account is locked by default. To enable SSH root
logins to the system, add the following line to the kickstart file.
%post
echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/01-permitrootlogin.conf
%end
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 the %post
heading. You can then
access files in the Kickstart file system with the newly installed system's root file system
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