Build a custom Fedora install CD

From Wiki
Revision as of 21:15, 26 February 2016 by Admin (Talk | contribs) (Created page with "</pre> For a clean Fedora 20 installation embed the kickstart file in a DVD. There are several posts available online describing how to achieve that http://docs.oracle.com/cd...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

</pre>

For a clean Fedora 20 installation embed the kickstart file in a DVD. There are several posts available online describing how to achieve that http://docs.oracle.com/cd/E37670_01/E41137/html/ch01s06.html (or just http://bit.ly/1hR3IkT ), but the exact syntax and functionality of ks=cdrom::/ks.cfg (not ks=cdrom:/ks.cfg ) tends to change over time, and there are several bugs open about this problem (e.g.: https://bugzilla.redhat.com/show_bug.cgi?id=963003 https://bugzilla.redhat.com/show_bug.cgi?id=1049237 ). Therefore below you find a solution that currently works for me (Fedora 20 x86_64). As an unprivileged user do:
   download iso and checksum (make sure you are in a directory with ~20GB free disk space):
   su -c "yum -y install wget"
   wget https://dl.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/iso/Fedora-20-x86_64-DVD.iso
   wget https://dl.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/iso/Fedora-20-x86_64-CHECKSUM
   test $(sha256sum Fedora-20-x86_64-DVD.iso | cut -d' ' -f1) == $(cat Fedora-20-x86_64-CHECKSUM | grep DVD | cut -d' ' -f1) || echo incorrect CHECKSUM
   mount and copy the iso for modifications:
   mkdir fedora.orig
   su -c "mount -o loop Fedora-20-x86_64-DVD.iso fedora.orig"
   /bin/cp -rp fedora.orig fedora
   modify the default kernel parameters (see https://wiki.archlinux.org/index.php/kernel_parameters ):
   sed -i 's|inst.stage2=hd:LABEL=Fedora.*x86_64 quiet|ks=cdrom::/ks.cfg|' fedora/isolinux/isolinux.cfg
   sed -i 's|inst.stage2=hd:LABEL=Fedora.*x86_64 nomodeset quiet|nomodeset ks=cdrom::/ks.cfg|' fedora/isolinux/isolinux.cfg
   After the edits the append lines should contain append initrd=initrd.img ks=cdrom::/ks.cfg.
   create ks.cfg in the root of the DVD (no need to create this file in the isolinux directory as some documentations suggest). This is the exact file from https://ask.fedoraproject.org/en/question/43364/kickstart-in-linux-rescue-mode/ :
   cat << 'EOF' > fedora/ks.cfg
   install
   cdrom
   # Root password (set to: password)
   # Change that using "openssl passwd -1" to generate MD5 encrypted passwd
   rootpw --iscrypted $1$U/zHbzw7$c4MRlApxFpvmPqrrxNvje/
   # System authorization information
   auth --useshadow --enablemd5
   # System locale
   timezone --utc America/New_York
   keyboard --vckeymap=us --xlayouts=us
   lang en_US.UTF-8
   # Clear the Master Boot Record
   zerombr
   # Partition clearing information
   clearpart --all --initlabel
   # Disk partitioning information
   # /boot must be outside LVM
   part /boot --fstype ext4 --size=500 --asprimary
   part swap --size 2000 --asprimary
   part pv.01 --fstype ext4 --size=1 --grow --asprimary
   volgroup VolGroup00 pv.01
   logvol / --fstype ext4 --name=lv_root --vgname=VolGroup00 --size=1 --grow
   # check repodata/*Fedora*comps.xml online for a list
   %packages
   @Core
   #@Basic Desktop
   #@GNOME
   %end
   EOF
   create the new iso and burn it:
   su -c "yum -y install dvd+rw-tools genisoimage"
   mkisofs -R --iso-level 4 -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o Fedora-20-x86_64-DVD-my.iso fedora
   growisofs -dvd-compat -speed=1 -Z /dev/cdrom=Fedora-20-x86_64-DVD-my.iso

After DVD booting select Install Fedora in order to install.

Note that the installation requires network access in order to perform network configuration. Moreover the DVD will not be ejected after the ... (more) </pre>