Guided Exercise: Automating Installation with
Kickstart
Outcomes
You should be able to:
Create a kickstart file.
Use ksvalidator to validate the kickstart file's syntax.
Copy /root/anaconda-ks.cfg on servera to a file called
/home/student/kickstart.cfg so that student can edit. Use the sudo cat
/root/anaconda-ks.cfg > ~/kickstart.cfg command to copy the contents of
/root/anaconda-ks.cfg to /home/student/kickstart.cfg. If sudo prompts for
the password of the student user, use student as the password.
[student@servera ~]$ sudo cat /root/anaconda-ks.cfg > ~/kickstart.cfg
[sudo] password for student: student
Make the following changes to /home/student/kickstart.cfg.
Comment out the reboot directive:
#reboot
Comment out the repo command for the BaseOS repository. Modify the repo
command for AppStream to point to the classroom's AppStream repository:
#repo --name="koji-override-0" --baseurl=http://download-node-
02.eng.bos.redhat.com/rhel-8/devel/candidate-trees/RHEL-8/RHEL-
8.0.0-20190213.0/compose/BaseOS/x86_64/os
repo --name="appstream"
--baseurl=http://classroom.example.com/content/rhel8.0/x86_64/dvd/Ap
pStream/
Change the url command to specify the classroom's HTTP installation source
media:
url --url="http://classroom.example.com/content/rhel8.0/x86_64/dvd/"
Comment out the network command:
#network --bootproto=dhcp --device=link --activate
Set the root password to redhat. Change the line that starts with rootpw to:
rootpw --plaintext redhat
Delete the line that uses the auth command and add the authselect select sssd
line to set the sssd service as the identity and authentication source.
authselect select sssd
In Red Hat Enterprise Linux 8, the authselect command replaces the
authconfig command.
Simplify the services command to look exactly like the following:
services --disabled="kdump,rhsmcertd" --enabled="sshd,rngd,chronyd"
Comment out the part and reqpart commands. Add the autopart command:
#reqpart
# Disk partitioning information
#part / --fstype="xfs" --ondisk=vda --size=8000
autopart
Delete all content between the %post section and its %end. Add the following
line: echo "Kickstarted on $(date)" >> /etc/issue
The entire %post section should look like this.
%post --erroronfail
echo "Kickstarted on $(date)" >> /etc/issue
%end
Simplify the package specification to look exactly like the following:
%packages
@core
chrony
dracut-config-generic
dracut-norescue
firewalld
grub2
kernel
rsync
tar
httpd
-plymouth
%end
When you are finished editing the file save and exit.
Use the ksvalidator command to check the Kickstart file for syntax errors.
[student@servera ~]$ ksvalidator kickstart.cfg
Copy kickstart.cfg to the /var/www/html/ks-config directory.
[student@servera ~]$ sudo cp ~/kickstart.cfg /var/www/html/ks-config
Installing and Configuring Virtual Machines
[root@host ~]# yum module list virt
Name Stream Profiles Summary
virt rhel [d][e] common [d] Virtualization modu
[root@host ~]# yum module install virt
[root@host ~]# virt-host-validate
Install the cockpit-machines package to add the Virtual Machines menu to Cockpit.
[root@host ~]# yum install cockpit-machines
If Cockpit is not already running, start and enable it.
[root@host ~]# systemctl enable --now cockpit.socket
To create a new virtual machine with Cockpit, access the Virtual Machines menu in the
Cockpit web interface. From there, click Create VM and enter the VM configuration in the
Create New Virtual Machine window.