Installing Debian GNU/Linux using netboot

This is just a short writeout on how I usually go about installing Debian GNU/Linux using netboot. I am not going to do it myself at the time I write this, since I am far to lazy, but since I have done it several times the last month the instruction should be useful, if not exact in every way.

To install Debian GNU/Linux on any machine using netboot you need to go through several steps.

Netboot

First of all you need a network environment where it is easy to netboot a box. I would (of course) recommend my own instructions on how to do this with a KNOPPIX-ISO. Just follow this or any other instruction that works for you.

Partition and format your drives

Now that you have created a netboot-environment, use it to netboot your machine into a running Debian GNU/Linux-system.

When this is done, you can start building the HDD-environment you want on your running box. Since you are not using any HDD at all at the moment, and since you (if you followed my instructions) have a pretty well-endowed netbooted system, you can even setup LVM or RAID in any way you want at this point. However, this instruction is not aimed at that, so please look for example at Root-on-LVM-on-RAID HOWTO, The Software-RAID HOWTO or Root RAID HOWTO cookbook if you are interested in this application of netbooted installs.

So, just get fdisk'ing and mkfs'ing to get the HDD-environment you wish for. When you are done, create a directory, for example /mnt/target or whatever, and mount your designated root-fs there. Also mount other partitions you want bootstrapped later on (for example /usr, /var etc).

Bootstrap

Now that you have your (so far) empty root-fs mounted at a convenient location, you have to bootstrap it. To be honest, I havent the foggiest idea on how to do this in a practical way on another system, but on Debian it is thankfully very easy. You just use the debootstrap command, that downloads and installs packets in any directory, and during the process creates a usable (but not bootable) Debian-system that can install new packages by its own.

So - use the command debootstrap sarge /mnt/target (if /mnt/target is where you mounted your root). You can also use any of the names of suites you find in /usr/lib/debootstrap/scripts/ if you dont want to use sarge.

I must warn you, though, the suites are sometimes broken. So if one doesnt work, dont be afraid to try another...

Boot

Now you need to make your new root bootable. This is sometimes the hardest step in this process, especially if you use strange and uncommon disc-setups (RAID, LVM or other mystical creatures), but it usually works nicely if you stay with the herd.

First of all, chroot into your new root: chroot /mnt/target.

Now you are actually inside your new system, if not booting it... now you have to get a kernel, and a bootloader. Take this moment to mount all the different parts of the system that you may need to build/install kernel/bootloader (/proc, /sys, /boot etc).

To get a kernel, the easiest way is just to apt-get install kernel-image-2.6.5-1-686 or any other kernel you want to use. To be able to do this, you may have to edit /etc/apt/sources.list, and to be able to do this you may have to apt-get install nano or any other editor you like. Bootstrapping is tedious :/

When you have your new kernel, you just install your favorite bootloader, apt-get install lilo, apt-get install grub or whichever bootloader you choose. Configure and run it, and you are probably set to go.

Now you just unmount/sync and reboot, and hopefully your system wont have to netboot again to work :D

(c) 2004 Martin Kihlgren <martin at troja.ath.cx>