IconsPage/info.png These are debconf seed files to help you customize an Ubuntu installation CD. For more information, see InstallCDCustomization.

100% automatic installation script

This preseed file was written by CraigBox for his employer, IT Partners. It automatically partitions and installs a machine, including a complex setup script that is run on first boot.

#### IT Partners Firewall 2.0
#### Preseed configuration file for Ubuntu 6.06

# If you're remastering a CD, you could use this:
#   preseed/file=/cdrom/preseed/firewall.seed
#
# While you're at it, you may want to throw a debconf/priority=critical in
# there, to avoid most questions even if the preseeding below misses some.
# And you might set the timeout to 1 in syslinux.cfg to avoid needing to hit
# enter to boot the installer.
#
# Language, country, and keyboard selection cannot be preseeded from a file,
# because the questions are asked before the preseed file can be loaded.
# Instead, to avoid these questions, pass some more parameters to the kernel:
#
#    debian-installer/locale=en_NZ
#    kbd-chooser/method=us
#

# Always install the server kernel.
d-i     base-installer/kernel/override-image    string linux-server
# Don't install usplash.
d-i     base-installer/kernel/linux/extra-packages-2.6  string

# Desktop system not installed; don't waste time and disk space copying it.
d-i     archive-copier/desktop-task     string ubuntu-standard
d-i     archive-copier/ship-task        string

# Only install the standard system and language packs.
d-i     pkgsel/install-pattern  string ~t^ubuntu-standard$
d-i     pkgsel/language-pack-patterns   string

# No language support packages.
base-config     base-config/install-language-support    boolean false

#### Shell commands.

# itp: copy the install script from the CD to the HDD, and set it
# in /etc/rc.local so it runs on first boot.

d-i     preseed/late_command            string cp -a /cdrom/preseed/install.sh /target/root; sed -i 's_exit 0_sh /root/install.sh_' /target/etc/rc.local; 

#### Network configuration.

# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
d-i     netcfg/choose_interface select auto

# Note that any hostname and domain names assigned from dhcp take
# precedence over values set here. However, setting the values still
# prevents the questions from being shown even if values come from dhcp.
d-i     netcfg/get_hostname     string unassigned-firewall
d-i     netcfg/get_domain       string unassigned-domain

# Disable that annoying WEP key dialog.
d-i     netcfg/wireless_wep     string

#### Mirror settings.

d-i     mirror/country          string New Zealand
d-i     mirror/http/hostname    string nz.archive.ubuntu.com
d-i     mirror/http/directory   string /ubuntu
d-i     mirror/suite            string dapper
d-i     mirror/http/proxy       string

### Partitioning.

# Partition the first disc found
d-i     partman-auto/disk       string /dev/discs/disc0/disc

# Create a small /boot partition, suitable swap, and uses the rest of the space
# for the root partition:
d-i     partman-auto/expert_recipe      string boot-root :: 100 50 100 ext3 $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{
 ext3 } mountpoint{ /boot } .  500 10000 1000000000 ext3 method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / } .  64 512 2048 linux
-swap method{ swap } format{ } .
# For reference, here is that same recipe in a more readable form:
#       boot-root ::
#       100 50 100 ext3
#               $primary{ } $bootable{ }
#               method{ format } format{ }
#               use_filesystem{ } filesystem{ ext3 }
#               mountpoint{ /boot }
#       .
#       500 10000 1000000000 ext3
#               method{ format } format{ }
#               use_filesystem{ } filesystem{ ext3 }
#               mountpoint{ / }
#       .
#       64 512 2048 linux-swap
#               method{ swap } format{ }
#       .
# (Craig changed this from 300%).

# This makes partman automatically partition without confirmation.
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

#### Boot loader installation.

# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i     grub-installer/only_debian      boolean true
# This one makes grub-installer install to the MBR if if finds some other OS
# too, which is less safe as it might not be able to boot that other OS.
d-i     grub-installer/with_other_os    boolean true

##### Finishing up the first stage install.

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

###### Time zone setup.

# Controls whether or not the hardware clock is set to GMT.

d-i     clock-setup/utc                 boolean true
d-i     time/zone                       string Pacific/Auckland

###### Account setup.

# To preseed the root password, you have to put it in the clear in this
# file. That is not a very good idea, use caution!
passwd          passwd/root-password            password whatever
passwd          passwd/root-password-again      password whatever

passwd          passwd/root-login               boolean true
# If you want to skip creation of a normal user account.
passwd          passwd/make-user                boolean false

###### Everything else.

# More flexibly, this runs a shell command and if it outputs the names of
# preseed files, includes those files. For example, to switch configs based
# on a particular usb storage device (in this case, a built-in card reader):

d-i     preseed/include string  debconf/exim.cfg debconf/clamav.cfg debconf/mailgraph.cfg debconf/ntop.cfg debconf/samba.cfg debconf/ssh.cfg

In the 'debconf' directory I keep answers for packages that would otherwise ask questions at installation time. I built these from the output of debconf-get-selections. For example, exim.cfg contains:

exim4-config    exim4/dc_noalias_regenerate     boolean false
exim4-config    exim4/dc_smarthost      string
exim4-config    exim4/dc_relay_domains  string
exim4-config    exim4/dc_relay_nets     string
exim4-base      exim4/purge_spool       boolean false
exim4-config    exim4/mailname  string  localhost.localdomain
exim4-config    exim4/dc_local_interfaces       string
exim4-config    exim4/dc_minimaldns     boolean false
exim4-config    exim4/exim3_upgrade     boolean true
exim4-config    exim4/dc_other_hostnames        string
exim4-config    exim4/dc_eximconfig_configtype  select  internet site; mail is sent and received directly using SMTP
exim4-config    exim4/no_config boolean true
exim4-config    exim4/hide_mailname     boolean
exim4-config    exim4/dc_postmaster     string
exim4-config    exim4/dc_readhost       string
exim4-config    exim4/use_split_config  boolean true
# Move yet undelivered mails from exim(v3) to exim4 spool?
exim4-base      exim4/move_exim3_spool  boolean false

In install.sh, you can put anything you want to run at first boot. I wanted finer grained control over what installed, in the way I had with base-config (which was removed with Ubuntu 6.06). This file runs once, called from /etc/rc.local, and then modifies the rc.local script so it will not run again:

INSTALL="apt-get install -y"
REMOVE="apt-get remove -y"

apt-get update

# email
$INSTALL exim4-daemon-heavy mailx mailgraph

# etc - loads cut

sed -i 's_sh /root/install.sh_exit 0_' /etc/rc.local

echo "Installation complete."



CategoryInstallation CategorySystem CategoryEmail

InstallCDCustomization/PreseedExamples (last edited 2011-04-09 01:01:06 by D9784B24)