4 Automating the Installation by Using Kickstart
The kickstart feature enables you to automate the OS installation. A kickstart installation uses a configuration file that instructs the installer how it should implement a specific installation. The feature offers the following benefits:
-
No user intervention is required during the installation process.
-
Greater facility in installing on multiple systems.
-
The configuration file is useful for troubleshooting a boot-time problem with an installed system.
You can use kickstart to install Oracle Linux locally. However, the best use of this feature is in the installation of the OS on multiple systems over the network. In network installations, a kickstart operation would include the following components:
-
Kickstart configuration file
-
Configured network that supports network installs such as providing connectivity so that different client systems can access the necessary installation and configuration files specific to those clients.
For an example of the configuration of a network installation, see Creating a Network Installation Setup.
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 of the file's configurations 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 terminated by 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 as well as individual packages. Names of package groups
use the @
prefix, such as @base
, to distinguish them from
individual packages.
To help determine 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 multiple packages, 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 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 is 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.mydom.com/scripts/post-config
.
.
.
%end
Starting the Kickstart Installation
To start the kickstart installation, ensure that you have prepared the following:
-
Access to the full installation media, which can be on a local CD-ROM drive or USB drive. See the instructions on media preparation.
-
Access to the kickstart configuration file.
Installing Over the Network
- Boot the system.
- During the boot sequence, access the system's BIOS.
- On the BIOS screen, change the system settings to boot from the network.
- Save the changes and continue with the boot process.
- When the boot menu appears, select an installation option then press either
E
(UEFI-based systems) or Tab (BIOS-based systems) to access the boot prompt. - Add the the location of the kickstart file in the network. The location must specify the
network server's protocol and FQDN or IP address. For example, if you are using an NFS
server, then you might enter the following
line:
For additional examples for identifying the network location of the configuration file, see Installation Source.nfs:options:fqdn/path-to-file
Note:
Another way of installing from the network is by using a boot server. In this scenario, the installation automatically begins when you turn on the system. See Creating a Network Installation Setup. -
Save the boot configuration revisions and continue the boot process.
At the end of the boot process, the installation proceeds immediately.
Installing Locally
-
Boot the system from the local boot media.
-
When the boot menu appears, select an installation option then press either
E
(UEFI-based systems) or Tab (BIOS-based systems) to access the boot prompt. - Add the appropriate option that identifies the location of the kickstart file, for
example:
inst.ks=cdrom:/dev/sbd1/tmp/ks.cfg
For more information about boot options, see Customizing Boot Loader Actions.
-
Save the boot configuration revisions and continue the boot process.
At the end of the boot process, the installation proceeds immediately.