Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
centos7 kickstart iso creation
# Mandatory Files: copied from Centos7 ISO installer (minimal/full dvd)
#
# $ROOT/cdroot/.discinfo
# $ROOT/cdroot/LiveOS/squashfs.img
# $ROOT/cdroot/isolinux/boot.cat
# $ROOT/cdroot/isolinux/initrd.img
# $ROOT/cdroot/isolinux/isolinux.bin
# $ROOT/cdroot/isolinux/vmlinuz
#
# see attached for the following files
# $ROOT/comps.xml
# $ROOT/cdroot/ks/ks.cfg
# $ROOT/cdroot/isolinux/isolinux.cfg
ROOT=`pwd`
ISO=$ROOT/custom.iso
# download needed packages
PKG_MANDATORY=$(sed -n 's|\(.*<packagereq type="mandatory">\)\(.*\)\(</packagereq>\)|\2|p' $ROOT/comps.xml | tr '\n' ' ')
PKG_DEFAULT=$(sed -n 's|\(.*<packagereq type="default">\)\(.*\)\(</packagereq>\)|\2|p' $ROOT/comps.xml | tr '\n' ' ')
PKG_INSTALLER_REQ="redhat-release authconfig deltarpm cryptsetup chrony firewalld grub2 grub2-tools kernel"
PKG_LIST="@core $PKG_INSTALLER_REQ $PKG_MANDATORY $PKG_DEFAULT"
RPMDB=$ROOT/rpmdb
RELEASE=7
RELEASE_RPM=http://mirror.pregi.net/pub/Linux/CentOS/7.0.1406/os/x86_64/Packages/centos-release-7-0.1406.el7.centos.2.3.x86_64.rpm
sudo rm -r $RPMDB
sudo rpm --root $RPMDB --initdb
sudo rpm --root $RPMDB -ivh $RELEASE_RPM
# make sure yum download x86_64 rpms only
cat <<EOF | sudo tee $RPMDB/etc/yum.conf
[main]
exclude=*.i386 *.i686
EOF
sudo mkdir -p $ROOT/cdroot/Packages
sudo rm -r $ROOT/cdroot/Packages/*
sudo yum --downloadonly --downloaddir=$ROOT/cdroot/Packages --releasever=$RELEASE --installroot $RPMDB -y --nogpgcheck install $(echo $PKG_LIST)
# for yum below 4.x use command below
sudo yumdownloader --destdir=$ROOT/cdroot/Packages --releasever=$RELEASE --installroot $RPMDB -y --nogpgcheck $(echo $PKG_LIST)
# create ISO
sudo createrepo -g $ROOT/comps.xml $ROOT/cdroot
sudo mkisofs -o $ISO -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -V 'CentOS7' -boot-load-size 4 -boot-info-table -R -J -v -T $ROOT/cdroot
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE comps PUBLIC "-//CentOS//DTD Comps info//EN" "comps.dtd">
<comps>
<group>
<id>core</id>
<name>Core</name>
<name xml:lang='af'>Kern</name>
<name xml:lang='am'>ማዕከላዊ ቦታ</name>
<name xml:lang='ar'>اللبّ</name>
<name xml:lang='as'>ভিত্তি</name>
<name xml:lang='bal'>هستگ</name>
<name xml:lang='be'>Падмурак</name>
<name xml:lang='bg'>Основа</name>
<name xml:lang='bn'>কোর</name>
<name xml:lang='bn_IN'>কোর</name>
<name xml:lang='bs'>Jezgra</name>
<name xml:lang='ca'>Nucli</name>
<name xml:lang='cs'>Úplný základ</name>
<name xml:lang='cy'>Craidd</name>
<name xml:lang='da'>Grundlæggende</name>
<name xml:lang='de'>Kern</name>
<name xml:lang='el'>Πυρήνας</name>
<name xml:lang='en_GB'>Core</name>
<name xml:lang='es'>Núcleo</name>
<name xml:lang='et'>Tuum</name>
<name xml:lang='fa'>اصل</name>
<name xml:lang='fi'>Keskeiset</name>
<name xml:lang='fr'>Core</name>
<name xml:lang='gl'>Núcleo</name>
<name xml:lang='gu'>મૂળ</name>
<name xml:lang='he'>ליבה</name>
<name xml:lang='hi'>कोर</name>
<name xml:lang='hr'>Jezgra</name>
<name xml:lang='hu'>Mag</name>
<name xml:lang='hy'>Հիմք</name>
<name xml:lang='ia'>Nucleo</name>
<name xml:lang='id'>Inti</name>
<name xml:lang='ilo'>Bugas</name>
<name xml:lang='is'>Lágmarkskerfi</name>
<name xml:lang='it'>Principale</name>
<name xml:lang='ja'>コア</name>
<name xml:lang='ka'>ბირთვი</name>
<name xml:lang='kn'>ಅಂತಸ್ಸಾರ</name>
<name xml:lang='ko'>핵심</name>
<name xml:lang='lv'>Pamatsistēma</name>
<name xml:lang='mai'>कोर</name>
<name xml:lang='mk'>Основни</name>
<name xml:lang='ml'>കോറ്‍</name>
<name xml:lang='mr'>कोर</name>
<name xml:lang='ms'>Teras</name>
<name xml:lang='nb'>Kjerne</name>
<name xml:lang='ne'>कोर</name>
<name xml:lang='nl'>Kern</name>
<name xml:lang='no'>Kjerne</name>
<name xml:lang='nso'>Bogare</name>
<name xml:lang='or'>ପ୍ରମୂଖ</name>
<name xml:lang='pa'>ਮੂਲ</name>
<name xml:lang='pl'>Rdzeń</name>
<name xml:lang='pt'>Núcleo</name>
<name xml:lang='pt_BR'>Núcleo</name>
<name xml:lang='ro'>Nucleu</name>
<name xml:lang='ru'>Основа</name>
<name xml:lang='si'>න්‍යෂ්ඨිය</name>
<name xml:lang='sk'>Jadro</name>
<name xml:lang='sl'>Jedro</name>
<name xml:lang='sq'>Bërthama</name>
<name xml:lang='sr'>Срж</name>
<name xml:lang='sr@latin'>Srž</name>
<name xml:lang='sr@Latn'>Srž</name>
<name xml:lang='sv'>Grund</name>
<name xml:lang='ta'>கோர்</name>
<name xml:lang='te'>అంతర్భాగం</name>
<name xml:lang='tg'>Система</name>
<name xml:lang='th'>แกนหลัก</name>
<name xml:lang='tr'>Çekirdek</name>
<name xml:lang='uk'>Основа</name>
<name xml:lang='ur'>مرکز</name>
<name xml:lang='vi'>Lõi</name>
<name xml:lang='zh_CN'>核心</name>
<name xml:lang='zh_TW'>核心</name>
<name xml:lang='zu'>Okuyikhona</name>
<description>Smallest possible installation.</description>
<description xml:lang='as'>ন্যূনতম ইনস্টল।</description>
<description xml:lang='bn'>ন্যূনতম ইনস্টলেশন।</description>
<description xml:lang='bn_IN'>ন্যূনতম ইনস্টলেশন।</description>
<description xml:lang='cs'>Nejmenší možná instalace.</description>
<description xml:lang='de'>Kleinstmögliche Installation.</description>
<description xml:lang='es'>La instalación más pequeña posible.</description>
<description xml:lang='fr'>Plus petite installation possible.</description>
<description xml:lang='gu'>નાનામાં નાના શક્ય સ્થાપન.</description>
<description xml:lang='hi'>लघुतम संभावित संस्थापन.</description>
<description xml:lang='ia'>Le minime possibile installation.</description>
<description xml:lang='it'>Minima installazione possibile.</description>
<description xml:lang='ja'>最小限のインストール</description>
<description xml:lang='kn'>ಅತ್ಯಲ್ಪಸಾಧ್ಯ ಅನುಸ್ಥಾಪನೆ.</description>
<description xml:lang='ko'>가능한 최소 설치</description>
<description xml:lang='ml'>സാധ്യമായ ഏറ്റവും ചെറിയ ഇന്‍സ്റ്റലേഷന്‍.</description>
<description xml:lang='mr'>शक्यतया सर्वात लहान प्रतिष्ठापन.</description>
<description xml:lang='or'>କ୍ଷୁଦ୍ରତମ ସମ୍ଭାବ୍ଯ ସ୍ଥାପନା।</description>
<description xml:lang='pa'>ਘੱਟੋ-ਘੱਟ ਸੰਭਵ ਇੰਸਟਾਲੇਸ਼ਨ।</description>
<description xml:lang='pl'>Najmniejsza możliwa instalacja.</description>
<description xml:lang='pt_BR'>Menor instalação possível</description>
<description xml:lang='ru'>Минимально возможная установка</description>
<description xml:lang='sv'>Minsta möjliga installation</description>
<description xml:lang='ta'>மிகச் சிறிய செயல்படுத்தக்கூடிய நிறுவல்.</description>
<description xml:lang='te'>సాధ్యమగు అతిచిన్న సంస్థాపన.</description>
<description xml:lang='uk'>Мінімально можливе встановлення.</description>
<description xml:lang='zh_CN'>最小可能安装。</description>
<description xml:lang='zh_TW'>最小型安裝。</description>
<default>false</default>
<uservisible>false</uservisible>
<packagelist>
<packagereq type="default">aic94xx-firmware</packagereq>
<packagereq type="default">alsa-firmware</packagereq>
<packagereq type="default">bfa-firmware</packagereq>
<packagereq type="default">dracut-config-rescue</packagereq>
<packagereq type="default">ivtv-firmware</packagereq>
<packagereq type="default">iwl1000-firmware</packagereq>
<packagereq type="default">iwl100-firmware</packagereq>
<packagereq type="default">iwl105-firmware</packagereq>
<packagereq type="default">iwl135-firmware</packagereq>
<packagereq type="default">iwl2000-firmware</packagereq>
<packagereq type="default">iwl2030-firmware</packagereq>
<packagereq type="default">iwl3160-firmware</packagereq>
<packagereq type="default">iwl3945-firmware</packagereq>
<packagereq type="default">iwl4965-firmware</packagereq>
<packagereq type="default">iwl5000-firmware</packagereq>
<packagereq type="default">iwl5150-firmware</packagereq>
<packagereq type="default">iwl6000-firmware</packagereq>
<packagereq type="default">iwl6000g2a-firmware</packagereq>
<packagereq type="default">iwl6000g2b-firmware</packagereq>
<packagereq type="default">iwl6050-firmware</packagereq>
<packagereq type="default">iwl7260-firmware</packagereq>
<packagereq type="default">kernel-tools</packagereq>
<packagereq type="default">libertas-sd8686-firmware</packagereq>
<packagereq type="default">libertas-sd8787-firmware</packagereq>
<packagereq type="default">libertas-usb8388-firmware</packagereq>
<packagereq type="default">linux-firmware</packagereq>
<packagereq type="default">microcode_ctl</packagereq>
<packagereq type="default">NetworkManager</packagereq>
<packagereq type="default">NetworkManager-tui</packagereq>
<packagereq type="default">postfix</packagereq>
<packagereq type="default">ql2100-firmware</packagereq>
<packagereq type="default">ql2200-firmware</packagereq>
<packagereq type="default">ql23xx-firmware</packagereq>
<packagereq type="mandatory">audit</packagereq>
<packagereq type="mandatory">basesystem</packagereq>
<packagereq type="mandatory">bash</packagereq>
<packagereq type="mandatory">biosdevname</packagereq>
<packagereq type="mandatory">btrfs-progs</packagereq>
<packagereq type="mandatory">coreutils</packagereq>
<packagereq type="mandatory">cronie</packagereq>
<packagereq type="mandatory">curl</packagereq>
<packagereq type="mandatory">dhclient</packagereq>
<packagereq type="mandatory">e2fsprogs</packagereq>
<packagereq type="mandatory">filesystem</packagereq>
<packagereq type="mandatory">glibc</packagereq>
<packagereq type="mandatory">hostname</packagereq>
<packagereq type="mandatory">initscripts</packagereq>
<packagereq type="mandatory">iproute</packagereq>
<packagereq type="mandatory">iprutils</packagereq>
<packagereq type="mandatory">iptables</packagereq>
<packagereq type="mandatory">iputils</packagereq>
<packagereq type="mandatory">irqbalance</packagereq>
<packagereq type="mandatory">kbd</packagereq>
<packagereq type="mandatory">kexec-tools</packagereq>
<packagereq type="mandatory">less</packagereq>
<packagereq type="mandatory">man-db</packagereq>
<packagereq type="mandatory">ncurses</packagereq>
<packagereq type="mandatory">openssh-clients</packagereq>
<packagereq type="mandatory">openssh-server</packagereq>
<packagereq type="mandatory">parted</packagereq>
<packagereq type="mandatory">passwd</packagereq>
<packagereq type="mandatory">plymouth</packagereq>
<packagereq type="mandatory">policycoreutils</packagereq>
<packagereq type="mandatory">procps-ng</packagereq>
<packagereq type="mandatory">rootfiles</packagereq>
<packagereq type="mandatory">rpm</packagereq>
<packagereq type="mandatory">rsyslog</packagereq>
<packagereq type="mandatory">selinux-policy-targeted</packagereq>
<packagereq type="mandatory">setup</packagereq>
<packagereq type="mandatory">shadow-utils</packagereq>
<packagereq type="mandatory">sudo</packagereq>
<packagereq type="mandatory">systemd</packagereq>
<packagereq type="mandatory">tar</packagereq>
<packagereq type="mandatory">tuned</packagereq>
<packagereq type="mandatory">util-linux</packagereq>
<packagereq type="mandatory">vim-minimal</packagereq>
<packagereq type="mandatory">xfsprogs</packagereq>
<packagereq type="mandatory">yum</packagereq>
<packagereq type="optional">dracut-config-generic</packagereq>
<packagereq type="optional">dracut-fips-aesni</packagereq>
<packagereq type="optional">dracut-fips</packagereq>
<packagereq type="optional">dracut-network</packagereq>
<packagereq type="optional">openssh-keycat</packagereq>
<packagereq type="optional">selinux-policy-mls</packagereq>
<packagereq type="optional">tboot</packagereq>
</packagelist>
</group>
<environment>
<id>minimal</id>
<name>Minimal Install</name>
<name xml:lang='as'>নূন্যতম ইনস্টল</name>
<name xml:lang='bn_IN'>ন্যূনতম ইনস্টল</name>
<name xml:lang='cs'>Minimální instalace</name>
<name xml:lang='de'>Minimale Installation</name>
<name xml:lang='es'>Instalación mínima</name>
<name xml:lang='fr'>Installation minimale</name>
<name xml:lang='gu'>ન્યૂનતમ સ્થાપન</name>
<name xml:lang='hi'>न्यूनतम संस्थापन</name>
<name xml:lang='it'>Installazione minima</name>
<name xml:lang='ja'>最小限のインストール</name>
<name xml:lang='kn'>ಕನಿಷ್ಟ ಅನುಸ್ಥಾಪನೆ</name>
<name xml:lang='ko'>최소 설치</name>
<name xml:lang='ml'>ഏറ്റവും കുറഞ്ഞ ഇന്‍സ്റ്റോള്‍</name>
<name xml:lang='mr'>किमान इंस्टॉल</name>
<name xml:lang='or'>ସର୍ବନିମ୍ନ ସ୍ଥାପନ</name>
<name xml:lang='pa'>ਘੱਟ ਤੋਂ ਘੱਟ ਇੰਸਟਾਲ</name>
<name xml:lang='pl'>Minimalna instalacja</name>
<name xml:lang='pt_BR'>Instalações Mínimas</name>
<name xml:lang='ru'>Минимальная установка</name>
<name xml:lang='ta'>குறைந்தபட்ச நிறுவல்</name>
<name xml:lang='te'>కనీసపు సంస్థాపన</name>
<name xml:lang='uk'>Мінімальна система</name>
<name xml:lang='zh_CN'>最小安装</name>
<name xml:lang='zh_TW'>最小型安裝</name>
<description>Basic functionality.</description>
<description xml:lang='as'>মৌলি কাৰ্য্যকৰীতা।</description>
<description xml:lang='bn_IN'>প্রাথমিক বৈশিষ্ট্য।</description>
<description xml:lang='cs'>Základní funkcionalita.</description>
<description xml:lang='de'>Grundlegende Funktionalität.</description>
<description xml:lang='es'>Funcionalidad básica.</description>
<description xml:lang='fr'>Fonctionnalité de base.</description>
<description xml:lang='gu'>મૂળભૂત વિધેય.</description>
<description xml:lang='hi'>मौलिक प्रकार्यात्मकता.</description>
<description xml:lang='it'>Funzione di base.</description>
<description xml:lang='ja'>基本的な機能です。</description>
<description xml:lang='kn'>ಮೂಲಭೂತ ಕ್ರಿಯಾಶೀಲತೆ.</description>
<description xml:lang='ko'>기본적인 기능입니다.</description>
<description xml:lang='ml'>അടിസ്ഥാന പ്രവൃത്തിവിശേഷണം.</description>
<description xml:lang='mr'>मूळ कार्यक्षमता.</description>
<description xml:lang='or'>ସାଧାରଣ କାର୍ଯ୍ୟକାରିତା।</description>
<description xml:lang='pa'>ਮੁੱਢਲੀ ਕਾਰਜਸ਼ੀਲਤਾ।</description>
<description xml:lang='pl'>Podstawowa funkcjonalność.</description>
<description xml:lang='pt_BR'>Função básica</description>
<description xml:lang='ru'>Базовая функциональность.</description>
<description xml:lang='ta'>அடிப்படை செயலம்சம்.</description>
<description xml:lang='te'>ప్రాథమిక ఫంక్షనాలిటి.</description>
<description xml:lang='uk'>Основні можливості.</description>
<description xml:lang='zh_CN'>基本功能。</description>
<description xml:lang='zh_TW'>基本功能。</description>
<display_order>5</display_order>
<grouplist>
<groupid>core</groupid>
</grouplist>
<optionlist>
</optionlist>
</environment>
<langpacks>
<match install="autocorr-%s" name="autocorr-en"/>
<match install="firefox-langpack-%s" name="firefox"/>
<match install="gimp-help-%s" name="gimp-help"/>
<match install="gnome-getting-started-docs-%s" name="gnome-getting-started-docs"/>
<match install="hunspell-%s" name="hunspell"/>
<match install="hyphen-%s" name="hyphen"/>
<match install="kde-l10n-%s" name="kdelibs"/>
<match install="libreoffice-langpack-%s" name="libreoffice-core"/>
<match install="man-pages-%s" name="man-pages"/>
<match install="mythes-%s" name="mythes"/>
</langpacks>
</comps>
default ks
prompt 1
timeout 100
label ks
menu label ^Kickstart
menu default
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CentOS7 inst.ks=cdrom:/dev/cdrom:/ks/ks.cfg
#version=RHEL7
text
skipx
shutdown
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=vda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='ph'
# System language
lang en_PH.UTF-8
# Network information
network --bootproto=dhcp --device=ens3 --onboot=off --ipv6=auto
network --device=lo --hostname=localhost.localdomain
# Root password
rootpw --iscrypted $6$5NcdEVSAUaZko3j8$JRn7.01JaBArJt229V./ec8X1DvoWrJ4Wv5cJGavHmhhcgeXFaA5mLf0Z6NeWPjp8bgx0hN/Y8OhLeht2u6Az1
selinux --permissive
# System services
firewall --service=ssh
services --enabled=chronyd
# System timezone
timezone Asia/Manila --isUtc
# System bootloader configuration
bootloader --location=mbr --boot-drive=vda
# Partition clearing information
clearpart --drives=vda --all --initlabel
# Disk partitioning information
part /boot --fstype="xfs" --ondisk=vda --size=500
part btrfs.10 --fstype="btrfs" --ondisk=vda --size=1000 --grow
btrfs none --label=centos --data=single btrfs.10
btrfs / --subvol --name=root centos
btrfs /home --subvol --name=home centos
%packages
@core
chrony
deltarpm
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment