Most of what I'm going to detail has been gleaned from the DebianInstaller wiki on remote installation. Many thanks to the author for providing a groundwork for this article. That article, however, does not mention what to do if there are multiple interfaces on the remote machine. As one does not have physical access to the remote machine, it is imperative that the remote computer has the correct address bound to the correct interface.
Some Caveats
As noted in the above link, this process is not to be taken lightly. You are most likely looking at this article because you need to install on a machine that you have no access to. If improperly configured, the kernel will either fail to boot on the remote machine or fail to bring up the network resulting in physical intervention being needed on the target computer. Triple-check your set up and test, test, test before deploying. I highly recommend using a virtual machine to make sure that the compiled kernel and initrd function as expected.
The process
1. You'll need a running Debian system somewhere to compile the installer kernel. I used a virtual machine and it made the process much easier.
2. Get the source for the debian-installer package:
Code: Select all
# apt-get source debian-installer
Code: Select all
# apt-get build-dep debian-installer
Code: Select all
nameif
Code: Select all
# aptitude install nameif
Code: Select all
build/pkg-lists/netboot/i386.cfg
Code: Select all
#include "network-console"
Code: Select all
d-i preseed/early_command /bin/nameif
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 installer0
d-i netcfg/disable_dhcp boolean true
d-i netcfg/get_nameservers string 192.168.2.3
d-i netcfg/get_ipaddress string 192.168.2.25
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 192.168.2.1
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
Code: Select all
build/config/local
Code: Select all
PRESEED=/PRESEED/LOCATION/<mypreseed.cfg>
Code: Select all
build/sources.list.udeb.local
Code: Select all
deb http://ftp.us.debian.org/debian stable main/debian-installer
deb http://ftp.us.debian.org/debian testing main/debian-installer
Code: Select all
fakeroot make rebuild_netboot
Code: Select all
cd tmp/netboot
mkdir initrd
cp initrd.gz initrd/
cd initrd/
gunzip initrd.gz
cpio -i --no-absolute-filenames < initrd #IMPORTANT! Without the --no-absolute-filenames option this will extract into root "/"
Code: Select all
cp /sbin/nameif bin/nameif
echo -e "installer0 00:00:00:00:00:01\n\ninstaller1 00:00:00:00:00:02" > etc/mactab
Code: Select all
find . | cpio -o -H newc > initrd
gzip -c initrd > initrd.gz
Code: Select all
cp initrd.gz ~/debian-installer-rd.gz
#cd back to the build/tmp/netboot directory
cp vmlinuz ~/debian-installer-vmlinuz
If grub1, add the following to the top of the /boot/grub/menu.lst:
Code: Select all
title debian installer
root (hd0,0)
kernel /boot/debian-installer-vmlinuz rw ramdisk_size=24000 root=/dev/rd/0
initrd /boot/debian-installer-rd.gz
Code: Select all
debian-installer-vmlinuz
Code: Select all
debian-installer-rd.gz
If grub2, rename the kernel image and initrd to include a kernel version. For example
Code: Select all
vmlinuz-2.6.32-5-686-installer
Code: Select all
initrd.img-2.6.32-5-686-installer
Code: Select all
# update-grub
Code: Select all
image=/boot/debian-installer-vmlinuz
label=debinst
read-write
ramdisk=24000
initrd=/boot/debian-installer-rd.gz
append="root=/dev/rd/0"
16. After you are absolutely sure everything is configured correctly, reboot the remote system.
17. SSH into the remote system:
Code: Select all
ssh installer@xxx.xxx.xxx.xxx
Code: Select all
mkdir /mnt/newinstall
mount /dev/sda1 /mnt/newinstall
rm /lib/udev/rules.d/75-persistent-net-generator.rules
rm /mnt/newinstall/lib/udev/rules.d/75-persistent-net-generator.rules
Code: Select all
/mnt/newinstall/etc/udev/rules.d/70-persistent-net.rules
Code: Select all
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:01", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
Code: Select all
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:01", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="installer0"
Code: Select all
exit
20. If you've done everything right, your remote computer will now boot into the newly installed Debian system. A couple of housecleaning items once booted into the new system:
-Change the interfaces from installer0,installer1 back to eth0,eth1:
Edit
Code: Select all
/etc/network/interfaces
Code: Select all
/etc/udev/rules.d/70-persistent-net.rules
21. Reboot one last time to make those changes final and configure your system however you see fit! And congratulations on installing a new OS without ever touching the machine!