Ubuntu unattended installation

Local mirror

For my media-box project i like to have a full ubuntu mirror close by, so i can easily re-install the box whenever i want to. Here are the instructions to set it up: (see also howtoforge)

apt-get install apt-mirror apache2

replace the http://archive.ubuntu.com/ubuntu with something faster. in my case http://ubuntu.tiscali.nl/ and comment out the src packages if you don't need them:

vi /etc/apt/mirror.list

############# config ##################
#
# set base_path    /var/spool/apt-mirror
#
# if you change the base path you must create the directories below with write privlages
#
# set mirror_path $base_path/mirror
# set skel_path   $base_path/skel
# set var_path    $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch i386
set nthreads 20
set tilde 0
#
############# end config ##############

deb http://ubuntu.tiscali.nl/ gutsy main restricted universe multiverse
deb http://ubuntu.tiscali.nl/ gutsy main/debian-installer universe multiverse
deb http://ubuntu.tiscali.nl/ gutsy main restricted/debian-installer universe multiverse
deb http://ubuntu.tiscali.nl/ gutsy-updates main restricted universe multiverse main/debian-installer
#deb http://ubuntu.tiscali.nl/ gutsy-backports main restricted universe multiverse
deb http://ubuntu.tiscali.nl/ gutsy-security main restricted universe multiverse
#deb http://ubuntu.tiscali.nl/ gutsy-proposed main restricted universe multiverse

#deb-src http://ubuntu.tiscali.nl/ gutsy main restricted universe multiverse
#deb-src http://ubuntu.tiscali.nl/ gutsy-updates main restricted universe multiverse
##deb-src http://ubuntu.tiscali.nl/ gutsy-backports main restricted universe multiverse
#deb-src http://ubuntu.tiscali.nl/ gutsy-security main restricted universe multiverse
##deb-src http://ubuntu.tiscali.nl/ gutsy-proposed main restricted universe multiverse

clean http://ubuntu.tiscali.nl/

Create the cron-entry for the repository:

vi /etc/cron.d/apt-mirror

#
# Regular cron jobs for the apt-mirror package
#
0 4     * * *   apt-mirror      /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log

And finally make the mirror available for via http:

ln -s /var/spool/apt-mirror/mirror/ubuntu.tiscali.nl /var/www/ubuntu

Unattended Installation

Setting up a preconfigured unattended setup, so i can quickly recover from a broken system: (see also debuntu)

apt-get install dhcp tftpd-hpa

vi /etc/dhcpd.conf

allow booting;
allow bootp;

host mediapc {
  hardware ethernet 01:23:45:67:89:ab;
  fixed-address mediapc.mydomain.com;
  filename "pxelinux.0";
}

Download netboot.tar.gz:

cd /var/lib/tftpboot
wget http://archive.ubuntu.com/ubuntu/dists/gutsy/main/installer-i386/current/images/netboot/netboot.tar.gz
tar -xvzf netboot.tar.gz
cd pxelinux.cfg

vi default

LABEL mediapc
kernel ubuntu-installer/i386/linux
append ramdisk_size=14984 locale=en_GB console-setup/layoutcode=en_GB netcfg/wireless_wep= netcfg/choose_interface=eth1 \
  netcfg/get_hostname= url=http://mirror.mydomain.com/preseed/mediapc.cfg vga=normal initrd=ubuntu-installer/i386/initrd.gz --

vi /preseed/mediapc.cfg