Skip to content

CentOS 7 Custom Media

Richard Harmonson edited this page Mar 18, 2020 · 20 revisions

[DRAFT]CentOS 7 Custom Media

yum install syslinux xorriso
mount -o loop CentOS-7-x86_64-Minimal-1908.iso /mnt

results

mount: /dev/loop14 is write-protected, mounting read-only
cd ~/
mkdir isobuild
shopt -s dotglob
cp -avRpf /mnt/. isobuild/
cd isobuild/
mount /mnt
sudo mv ks.cfg isobuild/isolinux/
sudo sed -i '/append\ initrd/s/$/ inst.ks=cdrom:\/isolinux\/ks.cfg/' isobuild/isolinux/isolinux.cfg
sudo sed -i '/linuxefi/s/$/ inst.ks=cdrom:\/isolinux\/ks.cfg/' isobuild/EFI/BOOT/grub.cfg
sudo mount -o loop isobuild/images/efiboot.img /mnt/iso/
sudo sed -i '/linuxefi/s/$/ inst.ks=cdrom:\/isolinux\/ks.cfg/' /mnt/iso/EFI/BOOT/grub.cfg
sudo umount /mnt/iso
blkid /root/CentOS-7-x86_64-Minmal-1908.iso

Results

blkid CentOS-7-x86_64-Minimal-1908.iso 
CentOS-7-x86_64-Minimal-1908.iso: UUID="2019-09-11-19-02-53-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"
pwd
/root/isobuild
mkisofs -o /root/custom.iso -b isolinux/isolinux.bin -J -R -l -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -graft-points -V "CentOS 7 x86_64"  .
pwd
/root/isobuild
sudo xorriso -as mkisofs -o /root/custom.iso -V "CentOS 7 x86_64" -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -R -J .
isohybrid /root/custom.iso
implantisomd5 /root/custom.iso
dd if=/root/custom.iso of=/dev/sdc bs=1M status=progress

Reference: https://forums.centos.org/viewtopic.php?t=71030


USB flash drive

If using an old USB flash drive or testing, writing to it may have unexpected results. Clean it first using the following procedure.

1. Use `lsblk` to list block devices and identify the USB flash drive, e.g. sdc
2. Use `unmount` to unmount existing partitions, e.g. /dev/sdc1
3. Use `fdisk /dev/sdc` to select the device
4. Use command `print` to display device information including partitions
5. Use command `d` to delete each partition
6. Use command `w` to write changes

In addition, it may be necessary to write a new dos or gpt partition table.
1. Use `fdisk /dev/sdc` to select the device
2. Use command `o` to create empty dos partition table
3. Use command `w` to write change

Make sure you do the above as a two step process, otherwise in my experience, it 
does not work. In addition, when using `dd` and it completes almost immediately, 
execute `sync` to write pending data to the USB flash drive before disconnecting.

Clone this wiki locally