Setting up netboot

Based on http://wiki.debian.org/DebianLive/Howto/Creating_a_Netboot_Image

apt-get install live-helper
apt-get install nfs-kernel-server # You need the package nfs-kernel-server. Apparently, nfs-user-server does not work with netboot
apt-get install dhcp3-server
apt-get install tftpd-hpa
apt-get install xinetd

ifconfig eth1 192.168.0.1

mkdir /srv/debian-live
echo “/srv/debian-live *(rw,sync,no_root_squash)” >> /etc/exports

mkdir mydeblive; cd mydeblive
lh_config
lh_config -a i386
lh_config –binary-images net
lh_config –net-root-path “/srv/debian-live”
lh_config –net-root-server “192.168.0.1”

lh_config –binary-images net \
–net-root-path “/srv/debian-live” \
–net-root-server “192.168.0.1”
lh_build

cp -R binary/ /srv/debian-live
mv /srv/debian-live/binary/live /srv/debian-live

cp -R tftpboot/* /var/lib/tftpboot
mv /var/lib/tftpboot/boot-screens/* /var/lib/tftpboot

iptables -t nat -F
# eth0 is outgoing internet connection (NOT the LAN iface for the netboot machines)
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

edit /etc/default/tftpd-hpa to make sure
RUN_DAEMON=”yes”

vim /etc/xinetd.d/tftp

service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /var/lib/tftpboot
disable = no
bind = 192.168.0.1
}

/etc/init.d/xinetd restart

or just run

in.tftpd -l -a 192.168.0.1 -v -v -p -s /var/lib/tftpboot/

You can place any executable scripts in:
config/chroot_local-hooks

Which will be executed when the image is being created, if you add more
scripts in here or change them, make sure to run lh_clean before lh_build, otherwise
they will NOT be run.

Useful script to go in:

#!/bin/bash
echo “I: update password”
echo “root:nopasswd” | chpasswd

Setting up public key access to SSH host

Rather than manually creating the authorized_keys file in the ‘.ssh’ directory on the host computer
you want to set up public key access for, you can instead use:

ssh-copy-id -i rsa.pub user@host

Which will use the rsa.pub public key and automatically create the file
in the correct users directory.