Howto Create a Custom Debian Installer Netinstall iso

Remote server installations or Custom distro:

This is handy if you need to have preconfigured netinstall isos for remote installations of servers. Or maybe you just want to create a custom Debian based distro. At work I create these isos tailor made to suit our customers needs (more or less) then perform an automated remote installation.

The basic steps:

The basics are that you download a Debian Netinstall iso : http://www.debian.org/CD/netinst/

We mount the iso to a temporary directory, where we insert a “Preseed” file which has our custom settings configured. Then we recreate the iso.

Custom preseed file:

Before doing anything you need to get the example Preseed and edit it to your liking:

http://www.debian.org/releases/lenny/example-preseed.txt

**All of these commands are performed as Root in the /root home directory.**

You know the risks of running as root, and I will take for granted that you are an experienced Linux user who respects the responsibility of being root.

Lets create a custom iso:

Create a temporary direcory to mount the iso:

mkdir -p loopdir

Mount the Debian netinstall iso:

mount -o loop debian_netinstall_iso.iso loopdir

Remove the cd dircetory

rm -rf cd

Recreate a new cd directory:

mkdir cd

Now we Rsync everything over from the loopdir to our new cd directory:

rsync -a -H –exclude=TRANS.TBL loopdir/ cd

Unmount the netinstall iso from loopdir:

umount loopdir

Make a new directory to extract the initrd.gz, change to that directory and extract:

mkdir irmod

cd irmod

**Note**

The initrd.gz for the 64bit Netinstall iso is in /install.amd/. If this command fails it’s becuase it is somewhere else. Just have a look for it and change the command accordingly.

*One command at a time, don’t copy and paste both lines* (arguments are two dashes not one ” – -“)

gzip -d < ../cd/install.amd/initrd.gz | \

cpio –extract –verbose –make-directories –no-absolute-filenames

Now we copy over our custom Preseed file to initrd:

cp ../my_preseed.cfg preseed.cfg

*One command at a time, don’t copy and paste both lines*

find . | cpio -H newc –create –verbose | \

gzip -9 > ../cd/install.amd/initrd.gz

Now we go back to the /root directory and remove the irmod directory:

cd ../

rm -fr irmod/

Change to the cd directory and create an Md5sum:

cd cd

md5sum `find -follow -type f` > md5sum.txt

Back to /root again to create your new iso:

cd ..

*One command at a time, don’t copy and paste both lines*

genisoimage -o name_of_you_iso.iso -r -J -no-emul-boot -boot-load-size 4 \

-boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ./cd

Now you have your own custom iso which you can burn to CD or run in VirtualBox or a chosen Emulator. Have a good read of the Preseed documentation as you can configure practically everything on the Netinstall iso, including adding your own custom Debian applications, themes, etc. basically you can go from automated basic netinstall to full blown distro. It’s up to you.

Advertisements

2 thoughts on “Howto Create a Custom Debian Installer Netinstall iso

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s