Tuesday, November 24, 2015

create ubuntu netinstall iso aka mini cd

1- downloads components
$ mkdir minicd && cd minicd
$ wget -q https://pci-ids.ucw.cz/pci.ids -O pci.ids
$ wget http://dl.panticz.de/ipxe/ipxe.iso
$ wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/preseed/master/pxe/isolinux.cfg -O isolinux.cfg

2- bash script to auto create iso image



mkdir iso

echo "copy isolinux files..."
cp /usr/lib/syslinux/isolinux.bin iso/
cp /usr/lib/syslinux/vesamenu.c32 iso/
cp /usr/lib/syslinux/hdt.c32 iso/
cp pci.ids iso

echo "download 32bit non-pae kernel and initrd..."
mkdir iso/nonpae
wget $reposite/ubuntu/dists/precise/main/installer-i386/current/images/netboot/non-pae/ubuntu-installer/i386/linux -O iso/nonpae/linux32
wget $reposite/ubuntu/dists/precise/main/installer-i386/current/images/netboot/non-pae/ubuntu-installer/i386/initrd.gz -O iso/nonpae/initrd32.gz

echo "download 32bit ${DIST} kernel and initrd..."
wget $reposite/ubuntu/dists/${DIST}/main/installer-i386/current/images/netboot/ubuntu-installer/i386/linux -O iso/linux32
wget $reposite/ubuntu/dists/${DIST}/main/installer-i386/current/images/netboot/ubuntu-installer/i386/initrd.gz -O iso/initrd32.gz

echo "download 64bit ${DIST} kernel and initrd..."
wget $reposite/ubuntu/dists/${DIST}/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux -O iso/linux64
wget $reposite/ubuntu/dists/${DIST}/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz -O iso/initrd64.gz

mount ipxe.iso /mnt/ -o loop
cp /mnt/ipxe.krn iso
umount /mnt

echo "download isolinux configuration..."
cp isolinux.cfg iso

echo "create iso image..."
mkisofs -q -V "UbuntuNetInstall" -o UbuntuNetInstall.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -r -J iso

echo "clean up..."
rm -r iso

3- save and run  the script it will generate an iso file name UbuntuNetInstall.iso in the same executed directory, we can change the ubuntu dist and  mirror repository address as you like.

$ sudo sh create-iso-mini.sh

No comments:

Post a Comment