Custom ISO für CentOS Installation

In manchen Fällen möchte man das ISO image für die Installation von CentOS „personalisieren“, beispielsweise um eine kickstart Datei für die automatische Installation einzufügen (falls die Installation via Booten vom Netzwerk nicht möglich ist).

In einem solchen Fall reicht es die originale ISO-Datei zu mounten, Dateien in ein Temporäres Verzeichnis auf der Festplatte zu kopieren, modifizieren und daraus ein neues ISO zu erstellen.

Das folgende Beispiel zeigt das einfügen einer kickstart Datei (ks.cfg) und einbinden dieser im bootloader:

mkdir -v /tmp/bootiso
mount -o loop /path/to/some.iso /tmp/bootiso
 
mkdir -v /tmp/bootisoks
cp -vr /tmp/bootiso/* /tmp/bootisoks/
umount /tmp/bootiso && rmdir /tmp/bootiso
 
chmod -R u+w /tmp/bootisoks
cp /path/to/someks.cfg /tmp/bootisoks/isolinux/ks.cfg
 
# evtl. zusätzliche RPMs rein kopieren
#cp /path/to/*.rpm /tmp/bootisoks/Packages/.
#cd /tmp/bootisoks/Packages && createrepo -dpo .. .
 
sed -i 's/append\ initrd\=initrd.img/append initrd=initrd.img\ ks\=cdrom:\/ks.cfg/' /tmp/bootisoks/isolinux/isolinux.cfg
cd /tmp/bootisoks && \ 
mkisofs -o /tmp/boot.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "CentOS 7 x86_64" -R -J -v -T isolinux/. .
 
# Optional: ISO für USB key erstellen
#isohybrid /tmp/boot.iso
 
# md5 checksumme einfügen (damit man bei der Installation das Medium testen kann)
implantisomd5 /tmp/boot.iso

Quellen

Published by

Steven Varco

Steven ist ein Redhat RHCE- und Kubernetes CKA Zertifizierter Linux-Crack und ist seit über 20 Jahren sowohl beruflich wie auch privat auf Linux spezialisiert. In seinem Keller steht ein Server Rack mit diversen ESX und Linux Servern.

2 thoughts on “Custom ISO für CentOS Installation”

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert