Installing Debian remotely using the network console

The DebianInstaller/NetworkConsole is really neat. It allows you to do some really cool stuff- like a completely remote full installation of Debian. These instructions detail how to do that.

Notes about this process

These instructions are not for the weak of heart. You'll need to be able to build and configure stuff for yourself. But they're a good dive into hacking the debian installer to do kinky stuff.

The target system is assumed to be running another version of linux (any one will, hopefully, do, as long as they're using a regular bootloader like lilo or grub (both tested)).


Because I can :)

Seriously, I wanted access to some of the new features of sarge, such as LVM on software RAID as root. This is quite easy to do if you use the installer, but a screaming nightmare otherwise. It really is easier to do it this way than to try and debootstrap something.

Cheesy disclaimer

I tried this only on i386 machines, running various versions of Red Hat Enterprise Linux (at the start :). I spent about 2 days on and off figuring this little sequence out. YMMV.

So let's roll

1. Grab the debian installer source:

        apt-get source debian-installer

2. Get the build deps:

        apt-get build-dep debian-installer
        apt-get install fakeroot

3. Modify the build/pkg-lists/netboot/i386.cfg file, add to the top:

        #include "network-console"

Note: You need to modifiy the config file for the target architecture. If you're targeting amd64 then you will add the above to build/pkg-lists/netboot/amd64.cfg instead of build/pkg-lists/netboot/i386.cfg.

4. Create a simple preseed file, with at least the following, and copy it to the /tmp directory:

 d-i debian-installer/locale            string en_US
 d-i debconf/priority                   select critical
 d-i auto-install/enabled               boolean true
 d-i netcfg/choose_interface            select eth0
 d-i netcfg/disable_dhcp                boolean true
 d-i netcfg/get_nameservers             string
 d-i netcfg/get_ipaddress               string
 d-i netcfg/get_netmask                 string
 d-i netcfg/get_gateway                 string
 d-i netcfg/confirm_static              boolean true
 d-i netcfg/get_hostname                string myserver
 d-i netcfg/get_domain                  string myhome.none
 d-i network-console/password           password password
 d-i network-console/password-again     password password

5. Modify (or create) the build/config/local file, and add the following. You should specify the path to your preseed file and the codename of the release for which you would like to build an installer (e.g. squeeze):


6. Build your netboot image. Change into the build/ directory, then:

        fakeroot make rebuild_netboot

7. Deploy your image to the target linux box. In the build/dest/netboot/debian-installer/i386/ directory, there's a vmlinuz and initrd.gz. Copy these files to your target box. Rename vmlinuz to debian-installer, the initrd.gz to debian-installer-rd.gz, and move them to the boot directory.

8. Modify your target box's bootloader config to add in the debian installer image.

For recent grub versions I used this:

 title debian installer
        root (hd0,0)
        kernel /debian-installer rw ramdisk_size=24000 root=/dev/rd/0
        initrd /debian-installer-rd.gz

For lilo:


(Note the root= is missing in this lilo image- this is because lilo tries to check that the root exists- which it probably won't. So I added it to the append instead. It seemed to work).

9. Finally, reconfigure your bootloader default image to be the debian installer, and reboot your target machine.

You can then ssh to installer@<target> once it starts responding to pings (remember to switch your terminal to UTF-8) and select to start menu. Heck I normally open 2 or 3 ssh sessions to tail the log files. It's awesome- the whole debian-installer experience from 3000 miles away. Sweet.