Friday, May 20, 2016

create ubuntu netinstall iso aka mini cd on ubuntu xenial update script

the old one works on ubuntu trusty, but it will not work on ubuntu xenial because the lib paths have changed

http://www.atechnote.com/2015/11/create-ubuntu-netinstall-iso-aka-mini-cd.html


so to make it work on ubuntu xenial, first follow the above link, then install a few packages, and update the bash script

1- install the following packages
$ sudo apt-get install syslinux live-build isolinux

2- new bash script

#!/bin/sh

DIST=$1
reposite=http://archive.ubuntu.com


mkdir iso

echo "copy isolinux files..."
cp /usr/lib/ISOLINUX/isolinux.bin iso/
cp /usr/lib/syslinux/modules/bios/*.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- to run we have to supplement the ubuntu code name like utopic, trusty, xenial, precise, or other that your repo has
example i create ubuntu 12.04 codename precise

$ sudo sh create-iso-mini.sh precise

No comments:

Post a Comment