pre-seeding & automated installation of debian

objective – get basic debian set up automatically on dell’s PE 1950 / 2950 servers. without much manual clicking.

#1
set up local tftp server
apt-get install atftpd

make sure it runs. in my case it’ll be at 10.16.10.1

#2
configure your dhcp server for mac of machine you want to image – in /etc/dhcp3/dhcpd.conf add:


  host install{
# put mac address of the machine
        hardware ethernet 00:22:19:5d:42:ca;
        fixed-address 10.16.10.55;
        option host-name "fresh";
        option domain-name-servers 10.16.10.1;
        option routers 10.16.10.1;
        option root-path "10.16.10.1:/";
        option subnet-mask 255.255.255.0;
        filename "pxelinux.0";
        option broadcast-address 10.16.10.255;
        next-server 10.16.10.1;
  }

#3
download and unpack to /tftproot debian’s netboot [ netboot.tar.gz ].

#4
add firmware for broadcom gigabit ethernet cards. based on this article:

mkdir /tftpboot/debian-installer/amd64/tmp
cd /tftpboot/debian-installer/amd64/tmp
# link might change, just remove file and find latest firmware-bnx2_XXXX_all.deb
wget http://ftp.fr.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-bnx2_0.17_all.deb
dpkg-deb -x firmware-bnx2_0.17_all.deb .
rm -rf firmware-bnx2_0.17_all.deb
find . -print0 | cpio -0 -H newc -ov | gzip -c > ../initrd.gz

modify /tftpboot/pxelinux.cfg and put:


prompt 1
timeout 0
SAY i386  - install 32 bit os
SAY amd64 - install 64 bit os
LABEL i386
       menu label i386
        kernel debian-installer/i386/linux
        append DEBCONF_DEBUG=5 vga=normal initrd=debian-installer/i386/initrd.gz debian-installer/locale=en_US console-keymaps-at/keymap=us hostname=fresh domain=mbnd.eu netcfg/dhcp_timeout=60 preseed/url=http://10.16.10.1/i386-ps.cfg netcfg/choose_interface=eth0 --
label amd64
        menu label amd64
        kernel debian-installer/i386/linux
        append DEBCONF_DEBUG=5 vga=normal initrd=debian-installer/i386/initrd.gz debian-installer/locale=en_US console-keymaps-at/keymap=us hostname=fresh domain=mbnd.eu netcfg/dhcp_timeout=60 preseed/url=http://10.16.10.1/amd64-ps.cfg netcfg/choose_interface=eth0 --

#5
put following preseeding file on some web server [ pointed by preseed/url directive in pxelinux config ]


# debconf-get-selections --installer > preseed.cfg
# debconf-get-selections >> preseed.cfg


d-i debian-installer/locale string en_US
d-i console-keymaps-at/keymap select us
d-i netcfg/choose_interface select eth0
d-i netcfg/get_hostname string fresh
d-i netcfg/get_domain string mbnd.eu

d-i netcfg/wireless_wep string


### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.
#d-i mirror/protocol string ftp
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.se.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i mirror/suite  string lenny

d-i clock-setup/utc boolean true


# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
# NTP server to use. The default is almost always fine here.
d-i clock-setup/ntp-server string 0.debian.pool.ntp.org
d-i     time/zone       string Zulu


### Partitioning
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-auto/init_automatically_partition select biggest_free
d-i partman-auto/choose_recipe select Manual
d-i partman-auto/expert_recipe         string my-layout :: 512 2048 4096 ext3 $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / } . 512 4096 409600 ext3 method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ /home } . 256 512 2048 ext3 method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ /var/log } . 32 32 32 ext3 method{ format } format{ } se_filesystem{ } filesystem{ ext3 } mountpoint{ /backup } . 512 2048 300% linux-swap method{ swap } format{ } .
d-i partman/confirm_write_new_label     boolean true
d-i partman/choose_partition            select     Finish partitioning and write changes to disk
d-i partman/confirm                     boolean true

# The kernel image (meta) package to be installed; "none" can be used if no
# kernel is to be installed.
#d-i base-installer/kernel/image string linux-image-2.6-486

d-i passwd/make-user boolean false
d-i passwd/root-password password r00tme
d-i passwd/root-password-again password r00tme


tasksel tasksel/first   multiselect
d-i time/zone string Zulu

#tzdata  tzdata/Zones/Etc        select  Zulu


d-i pkgsel/include string openssh-server firmware-bnx2
d-i pkgsel/upgrade select full-upgrade

popularity-contest popularity-contest/participate boolean false

### Boot loader installation
# Grub is the default boot loader (for x86). If you want lilo installed
# instead, uncomment this:
#d-i grub-installer/skip boolean true
# To also skip installing lilo, and install no bootloader, uncomment this
# too:
d-i lilo-installer/skip boolean true

d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true

# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note


# This first command is run as early as possible, just after
# preseeding is read.
#d-i preseed/early_command string anna-install some-udeb

# This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh

d-i pkgsel/include string ssh rsync less tcpdump mc bzip2 mtr-tiny screen

#6
let the machine boot from pxe

Leave a Reply

Your email address will not be published. Required fields are marked *

 

(Spamcheck Enabled)