Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e8e43f8

Browse files
committedMar 1, 2020
CentOS 8: Working KS for semi-automatic installation of servers
Attention: There seems to be a bug in CentOS 8 (including 8.1.1911) preventing automatic loading of ks.cfg from OEMDRV to work (at least it did not in our tests). You can add inst.ks=hd:sdX1/ks.cfg to he setup command line as workaround. This is not an error of this kickstart file. This commit contains also Smaller updates in README and CentOS 7 kickstart file
1 parent a2768cb commit e8e43f8

File tree

3 files changed

+133
-145
lines changed

3 files changed

+133
-145
lines changed
 

‎README.md

+21-16
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ setup of our bare metal VM host machines.
99

1010
## Table of Contents
1111

12-
* [HowTo, Tips and Tricks](#howto-tips-and-trick)
12+
* [HowTo, Tips and Tricks](#howto-tips-and-tricks)
1313
* [Validate Kickstart file, show differences between versions](#validate-kickstart-file-show-differences-between-versions)
14-
* [CentOS 7/8: automatically load Kickstart file from OEMDRVstorage device](#centos-78-automatically-load-kickstart-file-from-oemdrvstorage-device)
15-
* [CentOS 7/8: Create USB flash drive installation media](#centos-78-create-usb-flash-drive-installation-media)
1614
* [Debugging Hints](#debugging-hints)
17-
* [CentOS 7: Custom USB flash drive including the Kickstart file for installation](#centos-7-custom-usb-flash-drive-including-the-kickstart-file-for-installation)
15+
* [Automatically load Kickstart file from OEMDRV storage device](#automatically-load-kickstart-file-from-oemdrv-storage-device)
16+
* [Create USB flash drive CentOS installation media](#create-usb-flash-drive-centos-installation-media)
17+
* [Custom USB flash drive including a Kickstart file for installation](#custom-usb-flash-drive-including-a-kickstart-file-for-installation)
1818
* [Preparations](#preparations)
1919
* [Media creation](#media-creation)
2020
* [Further reading, useful links and notes](#further-reading-useful-links-and-notes)
@@ -53,8 +53,8 @@ ksvalidator ./foo.ks
5353

5454
### Debugging Hints
5555

56-
After Anaconda (the graphical installer) started, there are differen TTYs /
57-
terminals you can switch to (via `Ctrl+Alt+F<Number>` ort `Alt+F<Number>`):
56+
After Anaconda (the graphical installer) started, there are different TTYs /
57+
terminals you can switch to (via `Ctrl+Alt+F<Number>` or `Alt+F<Number>`):
5858

5959
* **TTY1:** Main information screen before starting the graphical installer
6060
(Anaconda). As well as the installation dialog when using `text` or `cmdline`.
@@ -66,16 +66,21 @@ terminals you can switch to (via `Ctrl+Alt+F<Number>` ort `Alt+F<Number>`):
6666
works.
6767
* `lsblk -l -p`
6868
* **TTY3**
69-
* The install log displaying messages from install program.
69+
* Install log: The install log displaying messages from install program (if any)
7070
* **TTY4**
71-
* The system log displaying messages from kernel, etc.
71+
* Strorage log: The system log displaying messages from kernel, etc.
7272
* **TTY5**
73-
* All other messages.
73+
* Program log: All other messages.
7474
* **TTY7**
7575
* The installation dialog when using the graphical installer.
7676

7777

78-
### CentOS 7/8: automatically load Kickstart file from `OEMDRV`storage device
78+
79+
### Automatically load Kickstart file from `OEMDRV` storage device
80+
81+
**Attention / FIXME:** There seems to be a bug in CentOS 8 (including 8.1.1911)
82+
preventing this automatism to work (at least it did not in our tests). You
83+
can add `inst.ks=hd:sdX1/ks.cfg` to he setup command line as workaround.
7984

8085
The CentOS setup can load your Kickstart file automatically without having to
8186
specify the `inst.ks=` boot option. To do so, one name the file `ks.cfg` and
@@ -120,7 +125,7 @@ Now just boot and make sure the additional USB key is present when the installat
120125

121126

122127

123-
### CentOS 7/8: Create USB flash drive installation media
128+
### Create USB flash drive CentOS installation media
124129

125130
Just validate your ISO and write it with `dd` to the target device `/dev/sdX`
126131
(adapt as needed). For sure, all data (if any) on the target will get detroyed.
@@ -135,10 +140,11 @@ $ sudo dd if=./CentOS-8.1.1911-x86_64-dvd1.iso of=/dev/sdX bs=8M status=progress
135140
```
136141

137142

138-
### CentOS 7: Custom USB flash drive including the Kickstart file for installation
143+
### Custom USB flash drive including a Kickstart file for installation
139144

140145
Attention: the following method will only work with **Legacy BIOS boot**. The
141-
USB Flash drive **will not boot with UEFI**.
146+
USB Flash drive **will not boot with UEFI**. This method propaply **does not
147+
work with CentOS 8** (or at least needs adaption).
142148

143149
#### Preparations
144150

@@ -500,7 +506,7 @@ KS_SNIPPET_PACKAGES="
500506
501507
${KS_SNIPPET_PACKAGES}
502508
503-
### Additional packages or package groups not dependend on the environment
509+
### Additional packages or package groups (not depended on the environment)
504510
@virtualization-hypervisor
505511
@virtualization-tools
506512
chrony
@@ -512,7 +518,6 @@ virt-top
512518
%end
513519
"
514520

515-
# FIXME
516521
export KS_SNIPPET_NETWORK
517522
export KS_SNIPPET_IGNOREDISK
518523
export KS_SNIPPET_BOOTLOADER
@@ -532,6 +537,6 @@ envsubst "$MYVARS" <./template.ks >/tmp/result.ks
532537
#### Kickstart via webserver or DHCP
533538

534539
* How to generate and serve kickstart file dynamically and use it with `inst.ks=http://`
535-
* HTTPS/TLS possible?
540+
* HTTPS/TLS possible? Cf. [5.3. Making a Kickstart file available on an HTTP or HTTPS server](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/performing_an_advanced_rhel_installation/making-kickstart-files-available-to-the-installation-program_installing-rhel-as-an-experienced-user#making-a-kickstart-file-available-on-an-http-or-https-server_making-kickstart-files-available-to-the-installation-program)
536541
* How does this work in terms of network config from syslinux boot menu? Cf. https://www.redhat.com/archives/kickstart-list/2007-July/msg00035.html
537542
* Existing projects or create one in golang, basic HTTP server and templating?

‎centos7-vmhost.ks ‎centos7-interactive.ks

+42-49
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
#version=RHEL7
22

3+
################################################################################
4+
# Kickstart file for semi-automatic installation of server systems (minimal or
5+
# GUI with GNOME).
6+
#
7+
# Purpose: implementing password, encryption and partitioning rules of Foundata
8+
################################################################################
9+
310

4-
#### Pre-install scripts
11+
#### Pre script
512
#
613
# Attention: Kickstart commands do NOT run until *after* the %pre section,
714
# despite the ordering in the kickstart file.
@@ -13,9 +20,8 @@
1320
# - You cannot change anything on the not-yet-installed system here.
1421
# If really needed, "%post --nochroot" might help.
1522
# - RHEL 7 Installation Guide, 26.3.3. Pre-installation Script, red.ht/2uUrzzU
23+
%pre --interpreter=/usr/bin/bash --erroronfail --log=/tmp/ks-pre.log
1624
17-
18-
%pre
1925
# Switch to /dev/tty6 (tty = TeleTYpewriter) for text console, redirect all
2026
# input and output, make /dev/tty6 the foreground terminal and start a shell
2127
# on it. The graphical interface (and therefore Anaconda) lives on /dev/tty1.
@@ -26,7 +32,7 @@ chvt 6
2632
# define regular expressions for input validation
2733
readonly regex_hostname='^[[:lower:]]([[:lower:][:digit:]\-]{0,61}[[:lower:][:digit:]])?$'
2834
readonly regex_domainname='^[[:lower:][:digit:]][[:lower:][:digit:]\-\.]{1,252}[[:lower:][:digit:]]$' # some domain NICs allow leading numbers and stuff; we cannot be stricter than them if we won't refuse really existing domains
29-
readonly regex_dmcryptpwd='^[[:alnum:][:punct:]]{20,}$' # ATTENTION: has to stricter or in sync than kickstart cmd "pwpolicy luks".
35+
readonly regex_dmcryptpwd='^[[:alnum:][:punct:]]{20,}$' # ATTENTION: has to be stricter or in sync than kickstart cmd "pwpolicy luks".
3036
3137
# init misc vars
3238
data_hostname=''
@@ -323,7 +329,7 @@ then
323329
then
324330
printf '%s\n' 'Error: Empty passwords are not allowed.'
325331
elif [ -z "${pwdscore}" ] ||
326-
[ "${pwdscore}" -lt 50 ] # ATTENTION: has to stricter or in sync than kickstart cmd "pwpolicy luks"
332+
[ "${pwdscore}" -lt 50 ] # ATTENTION: has to be stricter or in sync than kickstart cmd "pwpolicy luks"
327333
then
328334
printf '%s\n' "Error: Password is too weak (cf. \"Password rules\" above). pwscore result: ${pwdscore}"
329335
elif ! printf '%s' "${data_dmcrypt_pwdplain}" | grep -E -q -e "${regex_dmcryptpwd}"
@@ -351,7 +357,7 @@ then
351357
done
352358
unset pwdconfirm
353359
else
354-
printf 'Ok, system will be unencrypted.\n'
360+
printf 'Ok, system will NOT be encrypted.\n'
355361
fi
356362
printf '\n\n'
357363
fi
@@ -397,8 +403,7 @@ fi
397403
# logvol.ks
398404
if [ "$(printf '%d' $(cat '/proc/partitions' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | grep -E -e "${data_drive}\$" | tr -s '[:space:]' ' ' | cut -d ' ' -f 3))" -gt 86769664 ] # all linux blocks are currently 1024 bytes (cf. manpage vmstat(8))
399405
then
400-
# OS on different filesystem, more flexible, reduced risk of filled up root FS
401-
# 35840 + (5 x 10240) + 5120 + 2048 + 768 (boot) = 84736 MiB * 1024 = 86769664 bytes
406+
# using seperate partitions to reduced risk of filled up root filesystem.
402407
printf '%s\n' "$(cat <<-'DELIM'
403408
logvol / --vgname=vg01 --name=os_root --fstype="xfs" --size=10240
404409
logvol /home --vgname=vg01 --name=os_home --fstype="xfs" --size=2048
@@ -445,12 +450,6 @@ chrony
445450
kexec-tools
446451
rng-tools
447452
448-
### VM host (base)
449-
@virtualization-hypervisor
450-
@virtualization-tools
451-
virt-install
452-
virt-top
453-
libguestfs-tools
454453
DELIM
455454
)" >> /tmp/packages.ks
456455
if [ -n "${data_hostwithgui}" ] &&
@@ -463,8 +462,6 @@ then
463462
@fonts
464463
@input-methods
465464
@internet-browser
466-
virt-manager
467-
virt-viewer
468465
-cheese
469466
-empathy
470467
-totem
@@ -529,9 +526,6 @@ exec < /dev/tty1 > /dev/tty1 2> /dev/tty1
529526

530527

531528

532-
533-
534-
535529
###### Setup / Anaconda
536530

537531
# use graphical install
@@ -561,8 +555,6 @@ firstboot --enable
561555

562556
###### Internationalization (I18N), Localization (L10N)
563557

564-
565-
566558
# Keyboard layouts
567559
#
568560
# Hints and notes:
@@ -579,16 +571,17 @@ keyboard 'us'
579571
#
580572
# Hints and notes:
581573
# - Get list of supported timezones: timedatectl list-timezones
582-
# - --utc = System assumes the hardware clock is set to UTC time.
583-
# FIXME doc states --utc, files created by Anaconda are using --isUtc;
584-
# Which one is correct? cf. https://bugs.centos.org/view.php?id=3631
585-
#
586-
# [commented out, let user decide by using the UI Anaconda provides]: timezone Europe/Berlin --isUtc
587-
# NOTE: "timezone" is also commented out for another reason. A lack ot it
588-
# prevents Anaconda from starting the installation automatically. This
589-
# enables the user to use the UI to adapt misc settings before the
590-
# installation happens. Might be useful from time to time, especially
591-
# regarding network settings.
574+
# - --isUtc = System assumes the hardware clock is set to UTC time.
575+
# Please note: doc states --utc but files created by Anaconda on CentOS 7 are
576+
# using --isUtc; See also:
577+
# https://bugs.centos.org/view.php?id=3631
578+
# https://bugzilla.redhat.com/show_bug.cgi?id=1206226
579+
# - "timezone" is a required kickstart command for a complete automated install.
580+
# A lack ot it prevents Anaconda from starting the installation automatically.
581+
# This can be used to enable the user to use the UI to adapt misc settings
582+
# before the installation happens. Might be useful from time to time,
583+
# especially regarding network settings.
584+
# [commented out, let user decide by using the UI Anaconda provides]: timezone Europe/Berlin --isUtc
592585

593586

594587

@@ -600,9 +593,10 @@ auth --enableshadow --passalgo=sha512
600593

601594

602595
###### Users and groups
603-
604-
# Snippet to create SHA512 crypt compatible user password hashes:
605-
# python -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'
596+
#
597+
# Hints and notes:
598+
# - Snippet to create SHA512 crypt compatible user password hashes:
599+
# python -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'
606600

607601

608602
# user: root
@@ -688,41 +682,40 @@ volgroup vg01 pv.01
688682
%include /tmp/logvol.ks
689683

690684

685+
691686
###### Services (modifies systemd target "default")
692687

693688
services --enabled="chronyd"
694689

695690

691+
696692
###### GUI: (no) X Window System
693+
697694
%include /tmp/gui.ks
698695

699696

700697
###### Packages
701-
#
702698
# Notes:
703699
# - You can specify packages by environment, group, or by their package names.
704700
# - Get details of the available packages groups:
705701
# yum grouplist ids hidden
706702
# yum groupinfo <id>
707-
# or
708-
# dnf -v grouplist
709-
# dnf grouplist hidden
710-
# dnf groupinfo <id>
711703
# - See "RHEL 7 Installation Guide, 26.3.2. Package Selection" (cf.
712-
# red.ht/1ECqgSK) for more documentation
704+
# red.ht/1ECqgSK) for more information
713705
# - Syntax hints:
714706
# @^environment
715707
# @group
716708
# simple-package
717709
# Put a "-" in front for removal
710+
718711
%include /tmp/packages.ks
719712

720713

721714

722715
#### Kdump
723-
# Disabled on this machine (as we do not have support for CentOS nor usually
724-
# need this on a default system for debugging) - one might configure it later
725-
# in /etc/kdump.conf if needed.
716+
# Disabled on this machine (as we do not have vendor support for CentOS nor
717+
# usually need this on a default system for debugging) - one might configure it
718+
# later in /etc/kdump.conf if needed.
726719
%addon com_redhat_kdump com_redhat_kdump --disable
727720

728721
%end
@@ -750,22 +743,22 @@ pwpolicy user --minlen=10 --minquality=50 --strict --nochanges --notempty
750743

751744
# password policy for dm-crypt/LUKS
752745
# ATTENTION: One has to keep the %pre script stricter or in sync with the
753-
# following kickstart cmd (cf. regex_dmcryptpwd variable and pwscore
754-
# value when asking the user for a password).
746+
# following kickstart command (cf. regex_dmcryptpwd variable and
747+
# pwscore value when asking the user for a password).
755748
pwpolicy luks --minlen=20 --minquality=50 --strict --nochanges --notempty
756749

757750
%end
758751

759752

760753

761754
#### Post-install scripts
762-
#
763755
# Notes:
764756
# - For exchanging data between %pre and %post: cf. comments above %pre.
765757
# - If really needed, "%post --nochroot" can be used to change things on the
766758
# freshly installed system.
767759
# - RHEL 7 Installation Guide, 26.3.5. Post-installation Script, red.ht/1Q08cug
760+
#%post --interpreter=/usr/bin/bash --log=/root/ks-post.log
768761

769-
# %post
770-
# Nothing right now
771-
# %end
762+
# Nothing right now
763+
764+
#%end
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Please sign in to comment.