Preseed Configuration

Wikis > Informatique > Linux > PXE > Preseed Configuration

Un fichier preseed permet d’installer une distribution du type Ubuntu, Debian …, automatiquement.

Il suffit à l’installation de faire appel à ce fichier de configuration, ici appelé  »’conf.cfg »’, soit par le serveur PXE, soit démarrant sur la distribution par un média quelconque (CD, USB …)

Pour plus d’information sur les variables utilisables dans un fichier preseed reportez vous sur la page [http://d-i.alioth.debian.org/manual/fr.i386/apbs04.html preseed]

Voici un exemple de fichier preseed pour une installation de Debian automatisée.

*conf.cfg

### Localization
d-i debian-installer/language string fr
d-i debian-installer/country string FR
d-i debian-installer/locale string fr_FR
# Keyboard selection.
d-i console-keymaps-at/keymap select fr
d-i keyboard-configuration/xkb-keymap fr

### Network configuration
# 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 debian
#d-i netcfg/get_domain string languille11.fr
# If non-free firmware is needed for the network or other hardware, you can
# configure the installer to always try to load it, without prompting. Or
# change to false to disable asking.
d-i netcfg/choose_interface select auto
d-i hw-detect/load_firmware boolean false
d-i hw-detect/load_media boolean false

### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
# Suite to install.
d-i mirror/suite string wheezy

### Account setup
d-i passwd/root-login boolean true
d-i passwd/make-user boolean true

### Highlands user
passwd passwd/user-fullname string AnthonyM
passwd passwd/username string anthony
passwd passwd/user-password anthony my_password
passwd passwd/user-password-again anthony my_password

### create a password with `printf "r00tme" | mkpasswd -s -m md5`
d-i passwd/root-password-crypted password $1$9Tae/6c0$t3uaw3fe0KUQgF7/2cWRZ1

### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string EU/Paris
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string 0.debian.pool.ntp.org

### Partitioning Standard
d-i partman-auto/disk string /dev/sda
d-i partman-lvm/purge_lvm_from_device boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string                         \
      boot-root ::                                            \
              250 250 250 ext3                                \
                      $primary{ } $bootable{ }                \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext2 }    \
                      mountpoint{ /boot }                     \
              .                                               \
              4000 4000 4000 ext4                             \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      mountpoint{ / }                         \
              .                                               \
              2048 2048 2048 linux-swap                       \
                      method{ swap } format{ }                \
              .                                               \
              500 500 500 ext4                                \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      mountpoint{ /tmp }                      \
              .                                               \
              1000 10000 10000000 ext4                        \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      mountpoint{ /data }                     \
              .                                               

### Partitioning with LVM
#d-i partman-auto/disk string /dev/sda
#d-i partman-auto/method string lvm
#d-i partman-lvm/device_remove_lvm boolean true
#d-i partman-md/device_remove_md boolean true
#d-i partman-lvm/confirm boolean true
#d-i partman-auto-lvm/new_vg_name string data
#d-i partman-lvm/vgcreate string data
#d-i partman-auto/choose_recipe select atomic
#d-i partman-auto/expert_recipe string                         \
#
#      boot-root ::                                            \
#
#              250 250 250 ext2                                \
#
#                      $primary{ } $bootable{ }                \
#
#                      method{ format } format{ }              \
#
#                     use_filesystem{ } filesystem{ ext2 }    \
#
#                      mountpoint{ /boot }                     \
#
#              .                                               \
#
#
#              4000 4000 4000 ext4                             \
#
#                      $lvmok{ }                               \
#
#                      method{ format } format{ }              \
#
#                      use_filesystem{ } filesystem{ ext4 }    \
#
#                      mountpoint{ / }                         \
#
#              .                                               \
#
#              2048 2048 2048 linux-swap                       \
#
#                      $lvmok{ }                               \
#
#                      method{ swap } format{ }                \
#
#              .                                               \
#
#              500 500 500 ext4                                \
#
#                      $lvmok{ }                               \
#
#                      method{ format } format{ }              \
#
#                      use_filesystem{ } filesystem{ ext4 }    \
#
#                      lv_name{ tmp }                          \
#
#                      mountpoint{ /tmp }                      \
#
#              .						      \
#
#              10000 10000 100000000 ext4                      \
#
#                      $lvmok{ }                               \
#
#                      method{ format } format{ }              \
#
#                      use_filesystem{ } filesystem{ ext4 }    \
#
#                      lv_name{ data }                         \
#
#                      mountpoint{ /data  }                    \
#
#              .
#
# The full recipe format is documented in the file partman-auto-recipe.txt
# included in the 'debian-installer' package or available from D-I source
# repository. This also documents how to specify settings such as file
# system labels, volume group names and which physical devices to include
# in a volume group.

# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.

d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

### Apt setup
# You can choose to install non-free and contrib software.
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/services-select multiselect security
d-i apt-setup/security_host string security.debian.org

### Package selection
tasksel tasksel/first multiselect none
# Individual additional packages to install
d-i pkgsel/include string openssh-server
d-i pkgsel/upgrade select full-upgrade
popularity-contest popularity-contest/participate boolean false
d-i grub-installer/only_debian boolean true

### Finishing up the installation
d-i finish-install/reboot_in_progress note

### Post install
d-i preseed/late_command string \
cd /target; \
wget http://172.11.0.238/install/debian/script; \
chmod +x ./script; \
chroot ./ ./script; \
rm -f ./script

 »’Attention: »’ ne surtout pas mettre d’extension au script de post installation, car sinon il ne sera pas pris en compte