Jun 282011
 

In this post, I will walk through a simple preseed file that can be used to install a minimal Ubuntu machine in ~10 minutes (depending on the mirror used). The installer will only ask for the hostname. Everything else will be automated.

To get started, you will want to download the netboot ISO. You can get this from http://tinyurl.com/62qz9t7 or any other Ubuntu mirror. If all your machines are on the same network, it may make sense to setup gPXE. Details on that will be covered in a later post.

In order to use the preseed file outlined below, you will need to boot with the following appended options (press TAB at the installer screen). Note that the debugging variables are only necessary if you are having trouble.

DEBCONF_DEBUG=5 locale=en_US.UTF-8 console-setup/layoutcode=us url=http://www.siriad.com/preseed/preseed.cfg

The first thing we will do is configure the networking settings necessary to automate the install.

##############
# Networking
##############

# Uncomment and fill in these in order to preseed the hostname question
#d-i netcfg/get_hostname string unassigned-hostname
#d-i netcfg/get_domain string unassigned-domain
d-i netcfg/choose_interface select eth0
d-i mirror/http/proxy string

I am pointing to the default US Ubuntu archive. You should change this to suit your setup.

########################
# Installation Sources
########################

d-i mirror/country string US
d-i mirror/http/mirror string us.archive.ubuntu.com
d-i mirror/http/directory string /ubuntu/

Here, I am using the default partitioning scheme and wiping any existing partitions. You may need to change this if you want custom partitions.

#################################
# Disk Partitioning/Boot loader
#################################

d-i partman-auto/disk string /dev/sda
#d-i partman-auto/method string lvm
d-i partman-auto/method string regular
d-i partman-auto/purge_lvm_from_device boolean true

# And the same goes for the confirmation to write the lvm partitions.
#d-i partman-lvm/confirm boolean true

# You can choose from any of the predefined partitioning recipes.
# Note: this must be preseeded with a localized (translated) value.
#d-i partman-auto/choose_recipe \
#       select All files in one partition (recommended for new users)
#d-i partman-auto/choose_recipe \
#       select Separate /home partition
#d-i partman-auto/choose_recipe \
#       select Separate /home, /usr, /var, and /tmp partitions

# This makes partman automatically partition without confirmation.
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true

d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-pc/install_devices multiselect /dev/sda

Once again, your localization settings will likely differ from these, so modify as needed.

#################
# Localizations
#################

# Keyboard localization
d-i console-keymaps-at/keymap select us
#d-i console-setup/variantcode string dvorak

# Timezone
d-i clock-setup/utc boolean true
d-i time/zone string America/Chicago

d-i apt-setup/backports boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/multiverse boolean true
d-i apt-setup/non-free boolean true
d-i apt-setup/proposed boolean true
d-i apt-setup/universe boolean true

I usually don’t setup a default user when I install servers. These settings just create a root user (with login capabilities) having the password ‘r00tme’. You will not want to use this preseed file unmodified if your machine is connected directly to the internet. You can also configure preseed with a crypted root password, but I still recommend changing it once the install is complete.

#################
# User Creation
#################

d-i passwd/root-login boolean true
d-i passwd/make-user boolean false
d-i passwd/root-password password r00tme
d-i passwd/root-password-again password r00tme
d-i user-setup/allow-password-weak boolean true
d-i user-setup/password-weak boolean true

Setup Bcfg2 to do the post-install business (will be covered in a later post).

#######################
# Software Selections
#######################

tasksel tasksel/first multiselect
d-i pkgsel/include string openvpn vim
pkgsel pkgsel/include/install-recommends boolean false

# don't try and do automatic updates; that's bcfg2's job
d-i pkgsel/update-policy select none

d-i finish-install/reboot_in_progress note

d-i preseed/late_command string \
        in-target wget http://www.siriad.com/preseed/postinst.sh -O /root/postinst.sh; \
        in-target /bin/bash /root/postinst.sh
 Posted by at 14:08

  5 Responses to “Preseeding Ubuntu 10.04”

  1. Thanks for this post! I am working on developing a preseed file to install Ubuntu on my classroom machines. If you have time, could you answer a few questions for me?

    1. Can I set up more than one user using a preseed file? For example, I want one admin account and a separate account for student.

    2. Is there are way to install additional software? Among other applications, I would like to add Chromium, Flash, Java, VLC, and a the DVD playback items.

    3. Is it possible to set up Chromium preferences in a pressed file? For example, preventing password tracking, etc.

    Thanks for the help!

    • Jfro,

      While it is possible to do these things using preseed, you will probably be better off using something like Bcfg2 which will not only let you do these things initially, but will also allow you to manage the machine further down the line should you want to make any changes.

      What I usually do is run the preseed with a bare minimal install and then install and call Bcfg2 from the postinst.sh script that’s in the “d-i preseed/late_command string”.

      HTH

  2. Thanks for replying!

    I’m a relative newbie and the Bcfg2 website is rather technical. Would you mind summarizing what it does in more lay terminology?

    Would I create a repository with all the settings I am looking for and then sync each client with it?

    • Yeah, basically it allows you to define the goal ‘state’ of your machines. When you run the bcfg2 client, it will ask the server for it’s configuration and try to achieve the state specified in the configuration. A good place to start would be the Ubuntu quickstart page. Also, the guys in #bcfg2 on Freenode are really helpful should you have any questions.

  3. Thanks! I’ll look into this!

Leave a Reply to Jfro Cancel reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*