tech:debian_preseed_install_automatique_par_fichier_de_reponse
Table des matières
Debian Preseed - Install automatique par fichier de réponse
Voir live-usb
Liens :
Plop
VPN
CD personnalisé:
apt-get install debconf-utils debconf-get-selections --installer
mount -o loop /home/jean/iso/debian-8.2.0-amd64-CD-1.iso /mnt/iso/ rsync -a -H /mnt/iso/ /home/jean/dev/presseed/iso umount /mnt/iso chown jean: -R /home/jean/dev/presseed/iso chmod -R u+rwX /home/jean/dev/presseed/iso #fakeroot rm irmod/ -rf mkdir irmod cd irmod gzip -d < ../iso/install.amd/initrd.gz |cpio --extract --verbose --make-directories --no-absolute-filenames /bin/cp -f ../preseed.cfg preseed.cfg find . | cpio -H newc --create --verbose | gzip -9 > ../iso/install.amd/initrd.gz #exit cd .. cd iso md5sum $(find . -not -name "md5sum.txt" -follow -type f) > md5sum.txt cd .. genisoimage -o test.iso -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ./iso # Pour rendre "hybrid" l'iso, donc compatible USB en plus de CD/DVD # Paquet syslinux-utils ou alors paquet syslinux isohybrid test.iso
Pour le debug voir /var/log/installer/syslog
Note FRONTEND
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=text DEBIAN_FRONTEND=newt DEBIAN_FRONTEND=gtk FRONTEND_BACKGROUND=dark
Validation
Pour vérifier la syntaxe
sudo debconf-set-selections -c /path/to/preseed-debconf-file.txt
Preseed
# Preseed file for Debian
# Source http://wiki.deimos.fr/Automatiser_une_installation_de_Debian
### Contents of the preconfiguration file (for wheezy)
d-i debian-installer/language string en
d-i debian-installer/country string FR
d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/supported-locales multiselect en_US.UTF-8, fr_FR.UTF-8
### Keyboard
d-i keyboard-configuration/xkb-keymap select fr
d-i keyboard-configuration/xkb-keymap select fr(latin9)
d-i console-keymaps-at/keymap select fr
# keymap is an alias for keyboard-configuration/xkb-keymap
#d-i keymap select fr(latin9)
### Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string
### Other
d-i hw-detect/load_firmware boolean false
### Apt mirror
#d-i mirror/protocol string http
#d-i mirror/country string manual
#d-i mirror/http/hostname string ftp.fr.debian.org
#d-i mirror/http/directory string /debian
#d-i mirror/http/proxy string
#d-i mirror/suite string wheezy
d-i mirror/protocol string ftp
d-i mirror/ftp/hostname string ftp.fr.debian.org
d-i mirror/ftp/directory string /debian
d-i mirror/ftp/proxy string
### Account setup
d-i passwd/root-login boolean false
d-i passwd/make-user boolean true
d-i passwd/root-password password toor
d-i passwd/root-password-again password toor
d-i passwd/user-fullname string Defab
d-i passwd/username string exploit
d-i passwd/user-password password toor
d-i passwd/user-password-again password toor
d-i passwd/user-uid string 1010
### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string Europe/Paris
d-i clock-setup/ntp boolean true
### Partitioning
d-i partman-auto/choose_recipe select home
d-i partman-auto/method string regular
#d-i partman-lvm/device_remove_lvm boolean true
#d-i partman-md/device_remove_md boolean true
# MARK
d-i partman-auto/disk string /dev/sda
# MARK
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-md/confirm boolean true
d-i partman/mount_style select uuid
### Base system installation
d-i base-installer/install-recommends boolean false
### Apt setup
apt-cdrom-setup apt-setup/cdrom/set-first boolean false
# apt-cdrom-setup apt-setup/cdrom/set-next boolean false
apt-cdrom-setup apt-setup/cdrom/set-next boolean false
d-i apt-setup/contrib boolean true
d-i apt-setup/use_mirror boolean true
d-i apt-setup/services-select multiselect security, volatile
d-i apt-setup/security_host string security.debian.org
d-i apt-setup/volatile_host string volatile.debian.org
### Package selection
tasksel tasksel/first multiselect standard
d-i pkgsel/upgrade select safe-upgrade
popularity-contest popularity-contest/participate boolean false
d-i pkgsel/include string openssh-server build-essential vim curl wget sudo lm-sensors smartmontools openvpn
### Grub
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean false
# Due notably to potential USB sticks, the location of the MBR can not be
# determined safely in general, so this needs to be specified:
#d-i grub-installer/bootdev string /dev/sda
# To install to the first device (assuming it is not a USB stick):
d-i grub-installer/bootdev string default
# Finish install
d-i finish-install/reboot_in_progress note
d-i cdrom-detect/eject boolean true
# Postinstall
d-i preseed/late_command string \
in-target mkdir /root/.ssh ; \
in-target mkdir /root/preseed ; \
in-target /bin/sh -c "echo '192.168.15.6 pkiweb.lan' >> /etc/hosts" ; \
cp /cdrom/preseed/authorized_keys /target/root/.ssh/ ; \
in-target chown -R root:root /root/ ; \
in-target chmod -R go-rwx /root/.ssh/authorized_keys ; \
in-target sed -i 's/PermitRootLogin yes/PermitRootLogin without-password/g' /etc/ssh/sshd_config ; \
in-target /bin/sh -c "echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config'" ; \
in-target apt-get clean ; \
cp /cdrom/preseed/* /target/root/preseed ; \
in-target chmod +x /root/preseed/firstboot.sh ; \
in-target sed -i.bak "s%^exit 0%/root/preseed/firstboot.sh\x0aexit 0%" /etc/rc.local ;
Pb
Pb
/bin/preseed_command: return: line 23: Illegal number
Erreur.
Cette erreur survient à cause du retour ligne '\n'.
Solution Dans le cas présent, j'ai remplacé \n par \x0a
Exemple :
- preseed.cfg
d-i preseed/late_command string \ in-target sed -i.bak "s%^exit 0%/root/preseed/firstboot.sh\nexit 0%" /etc/rc.local ;
- preseed.cfg
d-i preseed/late_command string \ in-target sed -i.bak "s%^exit 0%/root/preseed/firstboot.sh\x0aexit 0%" /etc/rc.local ;
tech/debian_preseed_install_automatique_par_fichier_de_reponse.txt · Dernière modification : de Jean-Baptiste
