Installation initiale du système GNU/Debian

Le fichier preseed précédemment fournit à l'installateur est présenté ci-dessous. Il s'agit d'une version allégée du fichier exemple fournit par Debian (ici).

L'objet de ce fichier est de répondre à toutes les questions de l'installateur Debian de manière automatique. En particulier, le fichier contient:

  • le nom de la machine
  • l'interface réseau sélectionnée ainsi que les paramètres réseaux (en configuration statique)
  • la configuration du disque dur
  • le choix des paquets à installer
  • la mise en place d'une clé publique SSH pour les connexions ultérieures

preseed.cfg (Source)

# The values can also be preseeded individually for greater flexibility.
d-i debian-installer/language string en
d-i debian-installer/country string FR
d-i debian-installer/locale string en_US.UTF-8

# Keyboard selection.
# keymap is an alias for keyboard-configuration/xkb-keymap
d-i keyboard-configuration/xkb-keymap select fr
d-i keyboard-configuration/toggle select No toggling

# Continue the install without loading kernel modules?
d-i anna/no_kernel_modules boolean yes

# To pick a particular interface instead:
d-i netcfg/choose_interface select eth0

# If you prefer to configure the network manually, uncomment this line and
# the static network configuration below.
d-i netcfg/disable_autoconfig boolean true

# Static network configuration.
#
# IPv4 example
d-i netcfg/get_ipaddress string 192.168.122.11
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 192.168.122.254
d-i netcfg/get_nameservers string 192.168.122.254
d-i netcfg/confirm_static boolean true

# 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 ctrl-1
d-i netcfg/get_domain string api.runstack.net

# Disable that annoying WEP key dialog.
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 http.us.debian.org
d-i mirror/http/directory string /debian

# Suite to install.
d-i mirror/suite string jessie

# Root password, either in clear text
d-i passwd/root-password password xxxx
d-i passwd/root-password-again password xxxx

# To create a normal user account.
d-i passwd/user-fullname string cephsrv
d-i passwd/username string cephsrv
d-i passwd/user-password password xxxx
d-i passwd/user-password-again password xxxx

### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true

# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string Europe/Paris

# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true

# Alternatively, you may specify a disk to partition. If the system has only
# one disk the installer will default to using that, but otherwise the device
# name must be given in traditional, non-devfs format (so e.g. /dev/hda or
# /dev/sda, and not e.g. /dev/discs/disc0/disc).
# For example, to use the first SCSI/SATA hard disk:
d-i partman-auto/disk string /dev/vda
# In addition, you'll need to specify the method to use.
# The presently available methods are:
# - regular: use the usual partition types for your architecture
# - lvm:     use LVM to partition the disk
# - crypto:  use LVM within an encrypted partition
d-i partman-auto/method string lvm

# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home:   separate /home partition
# - multi:  separate /home, /usr, /var, and /tmp partitions
d-i partman-auto/choose_recipe select multi

# 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
d-i partman-basicfilesystems/no_mount_point yes

# Next you need to specify the physical partitions that will be used.
d-i partman-md/confirm boolean true
d-i partman-md/confirm_nooverwrite boolean true

# This makes partman automatically partition without confirmation.
d-i partman-md/confirm boolean true
d-i partman-md/confirm_nooverwrite boolean true
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, updates, backports
d-i apt-setup/security_host string security.debian.org

# Additional repositories, local[0-9] available
d-i apt-setup/local0/repository string \
       http://ftp.fr.debian.org/debian/ jessie-backports main contrib non-free
d-i apt-setup/local0/comment string Jessie backports

### Package selection
tasksel tasksel/first multiselect standard, ssh-server

d-i pkgsel/upgrade select full-upgrade

# Some versions of the installer can report back on what software you have
# installed, and what software you use. The default is not to report back,
# but sending reports helps the project determine what software is most
# popular and include it on CDs.
popularity-contest popularity-contest/participate boolean false

d-i grub-installer/only_debian boolean false
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev  string /dev/vda
d-i debian-installer/add-kernel-opts string console=ttyS0,115200n8 serial

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

# This is how to make the installer shutdown when finished, but not
# reboot into the installed system.
#d-i debian-installer/exit/halt boolean true
# This will power off the machine instead of just halting it.
d-i debian-installer/exit/poweroff boolean true

d-i preseed/late_command string \
  in-target mkdir /root/.ssh ; \
  echo "ssh-rsa AAAA..." > /target/root/.ssh/authorized_keys

Dans le contexte de OSFS, le choix est fait de générer autant de fichiers preseed que de systèmes voulus.

L'arborescence choisie est:

/srv
  +- tftp
      +- preseed
          +- ctrl-1
              +- preseed.cfg
          +- ctrl-2
              +- preseed.cfg
          +- ctrl-3
              +- preseed.cfg

Chaque fichier preseed.cfg correspond au modèle ci-dessus en mettant à jour:

  • netcfg/get_ipaddress: adresse IP, selon le plan d'adressage défini
  • passwd/root-password: mot de passe, root
  • passwd/root-password-again: mot de passe, root
  • passwd/user-password: mot de passe, utilisateur
  • passwd/user-password-again: mot de passe, utilisateur
  • preseed/late_command: clé publique SSH (authorized_keys du compte root)

Le plan d'adressage défini un préfixe par interface réseau et un même suffixe pour toutes les interfaces.

netprefix:
  api: {'prefix':'192.168.122', 'class':24, 'network':'192.168.122.0'}
  srv: {'prefix':'192.168.123', 'class':24, 'network':'192.168.123.0'}
  data: {'prefix':'192.168.124', 'class':24, 'network':'192.168.124.0'}
  iaas: {'prefix':'192.168.125', 'class':24, 'network':'192.168.125.0'}

netsuffix:
  os: 1
  ctrl-1: 11
  ctrl-2: 12
  ctrl-3: 13

Automatisation

Une fois l'environnement créé, la création des VM se fait à l'aide de:

# osfs env-create

Cette commande crée automatiquement l'ensemble des VM configurés dans l'environnement. À l'issue de cette commande, les VM peuvent être accédée par SSH.

Première page / Page précédante / Sommaire / Page suivante / Dernière page