Skip to content

Instantly share code, notes, and snippets.

@hempnall
Last active August 12, 2018 15:24
Show Gist options
  • Save hempnall/71bde2eba19965c47f629cd2de18a3f2 to your computer and use it in GitHub Desktop.
Save hempnall/71bde2eba19965c47f629cd2de18a3f2 to your computer and use it in GitHub Desktop.
REDHAT KICKSTART DVD CREATION
label ks
menu label ^Kickstart
menu default
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CentOS-Final inst.ks=cdrom:/dev/cdrom:/ks.cfg
default ks
prompt 0
timeout 180
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
reboot --eject
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=gb --xlayouts='gb'
# System language
lang en_GB.UTF-8
# Network information
network --bootproto=dhcp --device=enp0s3 --onboot=off --ipv6=auto --no-activate
network --hostname=localhost.localdomain
# Root password
rootpw --iscrypted $6$GZVdzyH8umAnxJkk$2qHkZLYZ.QBFiWECnnbQJz1f06UtMNyTtpMBooqo9NF9CDaMiJgncMVlLQ9UxzPJCXP0jG4JEFNeVTzaNkAlu.
# System services
services --enabled="chronyd"
# System timezone
timezone Europe/London --isUtc
user --name=admin --password=$6$jy5hC1Ayl2gwuzcg$iK3BfZl4PiJIfn2yIRrPal4IHVybkSAa5jlCDQZ5eyYnIbj61ACvEVKA4OutjfcpKj0WNe5H5J0pQ9ggMwju7/ --iscrypted --gecos="admin"
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
%packages
@^minimal
@core
chrony
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

Auto Install Tools

WORK IN PROGRESS

These makefile tool are designed to create unattended install media for Redhat and Debian family of Linux OSs

Redhat

To use the tool specify the following at the command line:

# rhiso DEVICE=/dev/cdrom KICKSTART=~/anaconda-ks.cfg

Note:

  • the volume label in the file isolinux.cfg must match the volume label used in the mkisofs command.
  • CentOS leaves a line boot: in the anaconda-ks file - this must be removed as the installer can not parse it.
  • you must add the reboot --eject command to the ks.cfg file, in order for the OS to boot to the logon prompt

The output .iso will be created in the same directory

Debian

Not done this one yet :-(

#! /usr/bin/make -f
IMAGE_NAME := CentOS-Final
KICKSTART := ks.cfg
#ISOFILE := you_must_specify_an_.iso
#DEVICE := /dev/cdrom
SOURCE := $(if $(ISOFILE),isofile,$(if $(DEVICE),device,folder))
DOCKER_IMAGE := centos
DOCKER_SHELL := sh -c 'cd /rhiso; /bin/bash'
DOCKER_COMMAND := docker run -it --mount type=bind,src="$$(pwd)",dst=/rhiso $(DOCKER_IMAGE) $(DOCKER_SHELL)
final.iso: working
mkisofs -o $@ \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-J -l -r -T -v -V $(IMAGE_NAME) \
$<
docker:
$(DOCKER_COMMAND) $(DOCKER_SHELL)
working: $(SOURCE)
mkdir $@
chmod -R u+w $@
cp -r $</* $@
working2: working $(KICKSTART)
mkdir -p $</isolinux
cp $(KICKSTART) $</isolinux/ks.cfg
sed -i 's/append\ initrd\=initrd.img/append initrd=initrd.img\ ks\=cdrom:\/ks.cfg/' $</isolinux/isolinux.cfg
isofile:
mkdir $@
mount -o loop $(ISOFILE) $@
device:
mkdir $@
mount $(DEVICE) $@
folder:
ln -s $(FOLDER) $@
macfolder:
mkdir $@
hdiutil attach -nomount $(ISOFILE)
mount -t cd9660 /dev/disk1 $@
error:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment