Debian unattend install

!!!! WARNING !!!

Debian 6.0.5 and 6.0.6 ( x64) seems to have a buggy netboot ( initrd.gz)

If you receiving an error like this during preseed: “No root file system is defined.” it’s because initrd.gz does not contains ANY drivers for ATA/SATA/SCSI

Here is an updated initrd.gz which will contains all drivers for detecting the HDD( by security reason I had to rename the file in ODT).

1. Deploy server:: RHEL 6.0

2. setup of tftp

— structure of /tftpboot directory:

|­­ boot.msg
|­­ debian-install
|           |­­ initrd.gz
|           `­­ linux
|­­ pxelinux.0
`­­ pxelinux.cfg
`­­ default

— content of /tftpboot/pxelinux.cfg/default

label 1 Debian
  kernel debian-install/linux
  append ramdisk_size=14984 auto=true priority=critical vga=normal initrd=debian-install/initrd.gz netcfg/choose_interface=eth1 netcfg/dhcp_timeout=30 url=http://10.10.1.6/debian/CFG/debian.cfg

— content of /tftpboot/msg/boot.msg

1. Debian unattended (x32 )

download the netboot installer clients need for booting:

wget ftp://ftp.us.debian.org/debian/dists/squeeze/main/installer-i386/20110106+squeeze3/images/netboot/debian-installer/i386//linux
wget ftp://ftp.us.debian.org/debian/dists/squeeze/main/installer-i386/20110106+squeeze3/images/netboot/debian-installer/i386//initrd.gz

3. setup of DHCP

ddns-update-style none;
allow booting;
allow bootp;

subnet 10.10.1.0 netmask 255.255.255.224 {
    range 10.10.1.8 10.10.1.19;   
    filename “pxelinux.0”;
    next-server 10.10.1.6;
}

4. setup apache and create mirror structure

— mkdir  -p  /storage/debian ( here we copy the content of debian dvd )

— apache setup

create /etc/httpd/conf.d/debian.conf

<Directory “/storage/debian”>
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

5. debian.cfg

d-i debian-installer/locale                   string en_US
d-i console-keymaps-at/keymap                 select us
# Static network configuration.
d-i netcfg/dhcp_timeout                        string 30
d-i netcfg/choose_interface                    select eth0
# Install source
d-i mirror/country                              string enter information manually
d-i mirror/http/hostname                        string 10.10.10.4
d-i mirror/http/directory                       string /debian
d-i mirror/codename                             string squeeze
d-i mirror/http/proxy                           string
d-i apt-setup/local0/repository                 string http://10.10.10.4 debian squeeze
d-i apt-setup/local0/comment                    string local debian squeeze repository main
d-i apt-setup/local1/repository                 string http://10.10.10.4 security squeeze/updates main
d-i apt-setup/local1/comment                    string local debian squeeze security repository
d-i apt-setup/security_host                     string
d-i debian-installer/allow_unauthenticated      string true
d-i finish-install/reboot_in_progress           note
d-i prebaseconfig/reboot_in_progress            note
d-i apt-setup/non-free                          boolean true
d-i apt-setup/contrib                           boolean true
### Clock and time zone setup
d-i clock-setup/utc                             boolean true
d-i clock-setup/ntp                             boolean true
d-i clock-setup/ntp-server                      string  0.cz.pool.ntp.org
d-i time/zone                                   string Europe/Prague
### Partitioning
d-i partman-auto/disk                            string /dev/sda
d-i partman-auto/method                          string regular
d-i partman-lvm/device_remove_lvm                boolean true
d-i partman-auto/purge_lvm_from_device           boolean true
d-i partman-lvm/confirm                          boolean true
d-i partman/alignment                            select cylinder
d-i partman/confirm                              boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition                     select finish
d-i partman/confirm_nooverwrite                  boolean true
#d-i grub-installer/with_other_os                 boolean true
d-i grub-installer/only_debian                   boolean true
#d-i grub-installer/grub2_instead_of_grub_legacy  boolean false

d-i partman-auto/expert_recipe string             \
 condpart ::                                      \
 100 100 100 ext3                                 \
     $primary{ } $bootable{ }                     \
     method{ format } format{ }                   \
     use_filesystem{ } filesystem{ ext3 }         \
     mountpoint{ /boot }                          \
 .                                                \
 1024 1024 1024 ext4                              \
     $primary{ }                                  \
     method{ format } format{ }                   \
     use_filesystem{ } filesystem{ ext4 }         \
     mountpoint{ / }                              \
 .                                                \
 4096 4096 4096 ext4                              \
     $primary{ }                                  \
     method{ format } format{ }                   \
     use_filesystem{ } filesystem{ ext4 }         \
     mountpoint{ /usr }                           \
 .                                                \
 1024 1024 1024 linux-swap                        \
     method{ swap } format{ }                     \
 .                                                \
 1024 1024 1024 ext4                              \
     $primary{}                                   \
     method{ format } format{ }                   \
     use_filesystem{ } filesystem{ ext4 }         \
     mountpoint{ /home }                          \
 .
# Root User
 # printf “pasword1212″ | mkpasswd -s -m md5
d-i     passwd/root-password-crypted                passwd    $1$Jb309hGn$/O0GmxsctnzK/QS3y/Wgn.
 # Local User
 passwd  passwd/make-user                           boolean false
# Software Selections
tasksel tasksel/first                               multiselect  database-server dns-server file-server ssh-server web-server standard
d-i     pkgsel/include                              string       ssh openvpn lvm2 mysql-server bind9 vim snmp ethtool sysstat ntp ntpdate nagios-nrpe-server
#d-i preseed/late_command                           string   wget http://10.10.10.4/debian/CFG/dopostinstall.sh -O /tmp/dopostinstall.sh; chmod +x /tmp/dopostinstall.sh; /bin/sh /tmp/dopostinstall.sh
mysql-server-5.1 mysql-server/root_password         password 123aaa
mysql-server-5.1 mysql-server/root_password_again   password 123aaa
mysql-server-5.1 mysql-server/start_on_boot         boolean true
samba-common    samba-common/encrypt_passwords      boolean true
samba-common    samba-common/dhcp                   boolean false
samba-common    samba-common/workgroup              string  WORKGROUP
samba-common    samba-common/do_debconf             boolean true
exim4-config     exim4/no_config                    boolean true
exim4-config     exim4/exim3_upgrade                boolean true

6. dopostinstall.sh

_SNIP_

#!/bin/bash

ETC=”/target/etc”
VAR=”/target/var”
HTTP=”http://10.10.1.6/debian&#8221;

#setup network interfaces

cat <<_NETFILE_ >$ETC/network/interfaces
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet static
        address 192.168.40.210
        netmask 255.255.255.0
        gateway 192.168.40.1

allow-hotplug eth1
        iface eth1 inet static
        address 10.10.1.1
        netmask 255.255.255.224

_NETFILE_
echo “router” >$ETC/hostname

#setup apt mirrors

cat <<_SOURCELIST_ >$ETC/apt/sources.list
deb http://ftp.de.debian.org/debian/ squeeze main
deb-src http://ftp.de.debian.org/debian/ squeeze main

deb http://security.debian.org/ squeeze/updates main contrib
deb-src http://security.debian.org/ squeeze/updates main contrib

deb http://ftp.de.debian.org/debian/ squeeze-updates main contrib
deb-src http://ftp.de.debian.org/debian/ squeeze-updates main contrib
_SOURCELIST_

….

…..

One response to “Debian unattend install

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s