Aller au contenu principal

Debian

Installation

Pour une meilleur intégration des hosts dans l'infrastructure, une personnalisation de l'image OS est indispensable. Cette personnalisation permet de :

  • d'automatiser l'installation
  • de partitionner le disque
  • de créer l'utilisateur
  • d'installer des programmes au préalable

En effet un ensemble d'instructure est défini dans le fichier preseed.cfg de l'image

Creation de l'image Debian à partir de MacOs

# INTALL UTILS 
brew install xorriso p7zip

# DOWNLOAD
curl -L -o debian-13.1.0-amd64-netinst.iso \
https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-13.1.0-amd64-netinst.iso

# EXTRACT
7z x debian-13.1.0-amd64-netinst.iso -odebian-custom

# BUILD
xorriso -as mkisofs \
-r -V "DEBIAN_CUSTOM" \
-o debian-server-custom.iso \
-J -isohybrid-mbr /usr/local/share/syslinux/isohdpfx.bin \
-partition_offset 16 \
-b isolinux/isolinux.bin \
-c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-eltorito-alt-boot \
-e boot/grub/efi.img \
-no-emul-boot -isohybrid-gpt-basdat \
debian-custom

Édition du preseed.cfg

### --- Debian Server Automated Installation (English/US) --- ###

### Language and keyboard
d-i debian-installer/language string en
d-i debian-installer/locale string en_US.UTF-8
d-i console-keymaps-at/keymap select us
d-i keyboard-configuration/xkb-keymap select us

### Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string debian
d-i netcfg/get_domain string local

### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string deb.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string

### Root user setup
d-i passwd/root-login boolean true
d-i passwd/root-password password root
d-i passwd/root-password-again password root
d-i passwd/make-user boolean false

### Time zone
d-i time/zone string Europe/Paris
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true

### Disk selection
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-partitioning/choose_label string gpt

### Custom partitioning recipe
d-i partman-auto/expert_recipe string \
custom :: \
d-i partman-auto/method string regular
d-i partman-auto/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-lvm/confirm boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select efi-boot-swap-root
# 512M efi, 1G /boot, 8G swap, 100G / (this will get all remaining space)
d-i partman-auto/expert_recipe string \
efi-boot-swap-root :: \
5 5 5 free \
$bios_boot{ } \
method{ biosgrub } \
. \
512 512 512 fat32 \
$primary{ } \
method{ efi } format{ } \
label{ SYSTEM } \
. \
1024 1024 1024 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
label{ BOOT } \
. \
8192 16384 8192 linux-swap \
$primary{ } \
method{ swap } format{ } \
label{ SWAP } \
. \
25000 25000 25000 ext4 \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
. \
25000 25000 25000 ext4 \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /usr } \
. \
10000 10000 -1 xfs \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
mountpoint{ /var } \
.

d-i partman-auto/choose_recipe select custom
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/finish/confirm boolean true
d-i partman/confirm boolean true

### Package selection
tasksel tasksel/first multiselect standard, ssh-server
d-i pkgsel/include string vim htop curl wget net-tools sudo
popularity-contest popularity-contest/participate boolean false

### Grub installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string /dev/sda

### End of installation
d-i finish-install/reboot_in_progress note