-
Create working directory:
mkdir debinst
-
Download netinstall image:
(cd debinst && curl -OL https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.4.0-amd64-netinst.iso)
-
Prepare
debinst/preseed.cfg
with following content:# prevent questions for network configuration d-i netcfg/get_hostname string debian d-i netcfg/get_domain string local # activating of remote installation over SSH d-i anna/choose_modules string network-console d-i network-console/password password installer d-i network-console/password-again password installer # netcfg will choose an interface that has link if possible. This makes it # skip displaying a list if there is more than one interface. d-i netcfg/choose_interface select auto
-
Run docker container to prepare new ISO:
docker run --rm -it -v $PWD/debinst:/mnt/debinst debian bash
(Note: The following commands are assumed to be executed inside the container.)
-
Install required packages:
apt update && apt install -y --no-install-recommends xorriso isolinux cpio nano
-
Create temp directory for ISO image:
export ISO_FILES="$(mktemp -d)"
-
Extract original installation image to temp directory:
xorriso -osirrox on -indev /mnt/debinst/debian-*-amd64-netinst.iso -extract / $ISO_FILES
-
Extract
initrd.gz
:gunzip $ISO_FILES/install.amd/initrd.gz
-
Add
preseed.cfg
toinitrd
:(cd /mnt/debinst && echo preseed.cfg | cpio -H newc -o -A -F $ISO_FILES/install.amd/initrd)
-
gzip back
initrd
:gzip $ISO_FILES/install.amd/initrd
-
Recalculate md5 sum:
(cd $ISO_FILES; md5sum `find -follow -type f` > md5sum.txt)
-
Modify
$ISO_FILES/boot/grub/grub.cfg
:nano $ISO_FILES/boot/grub/grub.cfg
- Add menu timeout to the top of file:
set timeout=10
- Insert new menu entry for automatic install before all current entries:
menuentry --hotkey=r 'Remote install' { set background_color=black linux /install.amd/vmlinuz auto=true vga=788 --- quiet initrd /install.amd/initrd.gz }
- Add menu timeout to the top of file:
-
Make new ISO image:
xorriso -as mkisofs -o /mnt/debinst/debian-preseed.iso -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat $ISO_FILES
-
Exit docker container:
exit
-
Flash ISO image to external drive:
sudo dd if=./debinst/debian-preseed.iso of=/dev/disk2 bs=1m
-
Plug flash drive into target machine and boot from it.
-
Check DHCP server for IP address of target machine and connect to installator via SSH:
ssh installer@target
(Note: Use the password from
preseed.cfg
to authenticate.)
- https://github.com/paullockaby/preseed/blob/main/build
- https://itdraft.ru/2019/12/17/avtomaticheskaya-ustanovka-debian-pri-pomoshhi-preseed/
- https://unix.stackexchange.com/questions/43012/remote-accessible-live-distribution-aka-live-cd
- https://sleeplessbeastie.eu/2015/10/12/how-to-install-debian-remotely/
- https://www.debian.org/releases/bullseye/example-preseed.txt