Чтобы быстро и без лишних вопросов установить на компьютер Debian, можно воспользоваться файлом ответов preseed.cfg, в котором установщику указываются все нужные при установке параметры. (Аналог Autounattend.xml в Windows). Параметры, которые хочется ввести вручную, например разбиение диска, там указывать не нужно и тогда будет возможность сделать это самому.
Информации об этом в интернете, особенно с учётом реального опыта, не так уж и много. Дольше всего пришлось разбираться, как же правильно "подсунуть" файл ответов инсталлятору Debian. (В Windows достаточно просто положить Autounattend.xml в корень инсталляционного носителя).
Примерный файл ответов для Debian 13 выглядит так:
Скрытый текст
### Localization
d-i debian-installer/language string ru
d-i debian-installer/country string RU
d-i debian-installer/locale string ru_RU.UTF-8
# Keyboard selection.
d-i keyboard-configuration/xkb-keymap select ru
d-i keyboard-configuration/toggle select Alt+Shift
### Network configuration
# Disable network configuration entirely. This is useful for cdrom
# installations on non-networked devices where the network questions,
# warning and long timeouts are a nuisance.
d-i netcfg/enable boolean false
# 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 home.lan
# If you want to force a hostname, regardless of what either the DHCP
# server returns or what the reverse DNS entry for the IP is, uncomment
# and adjust the following line.
d-i netcfg/hostname string debian
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
# 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 hw-detect/load_firmware boolean true
### Account setup
# Root password, either in clear text
d-i passwd/root-password password PassW0rd1
d-i passwd/root-password-again password PassW0rd1
# or encrypted using a crypt(3) hash.
#d-i passwd/root-password-crypted password [crypt(3) hash]
# To create a normal user account.
d-i passwd/user-fullname string Administrator
d-i passwd/username string administrator
# Normal user's password, either in clear text
d-i passwd/user-password password PassW0rd2
d-i passwd/user-password-again password PassW0rd2
# The user account will be added to some standard initial groups. To
# override that, use this.
d-i passwd/user-default-groups string sudo
### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean false
# 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/Moscow
### Apt setup
# Choose, if you want to scan additional installation media
# (default: false).
d-i apt-setup/cdrom/set-first boolean false
# You can choose to install non-free firmware.
d-i apt-setup/non-free-firmware boolean true
# 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
# Uncomment the following line, if you don't want to have the sources.list
# entry for a DVD/BD installation image active in the installed system
# (entries for netinst or CD images will be disabled anyway, regardless of
# this setting).
d-i apt-setup/disable-cdrom-entries boolean true
# Uncomment this if you don't want to use a network mirror.
d-i apt-setup/use_mirror boolean false
### Package selection
tasksel tasksel/first multiselect standard, kde-desktop
# Individual additional packages to install
d-i pkgsel/include string openssh-server sudo mc firefox-esr-l10n-ru libreoffice-l10n-ru libreoffice-help-ru
popularity-contest popularity-contest/participate boolean false
### Boot loader installation
# Grub is the boot loader (for x86).
# This is fairly safe to set, it makes grub install automatically to the UEFI
# partition/boot record if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
# This one makes grub-installer install to the UEFI partition/boot record, if
# it also finds some other OS, which is less safe as it might not be able to
# boot that other OS.
d-i grub-installer/with_other_os boolean true
### Finishing up the installation
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
#### Advanced options
### Running custom commands during the installation
# This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
d-i preseed/late_command string \
echo "# Debian 13 (trixie) Standart Repo" > /target/etc/apt/sources.txt; \
echo "deb http://deb.debian.org/debian trixie main contrib non-free-firmware non-free" >> /target/etc/apt/sources.txt; \
echo "deb http://deb.debian.org/debian trixie-updates main contrib non-free-firmware non-free" >> /target/etc/apt/sources.txt; \
echo "deb http://security.debian.org/debian-security trixie-security main contrib non-free-firmware non-free" >> /target/etc/apt/sources.txt; \
in-target mv /etc/apt/sources.txt /etc/apt/sources.list; \
in-target chmod 644 /etc/apt/sources.list
Данный файл ответов устанавливает Debian 13 со средой KDE-desktop с образа DVD без использования сети и сетевых репозиториев. Сразу ставятся некоторые нужные пакеты: Firefox-esr, LibreOffice, sudo и Midnight Commander. Также автоматически создаётся пароль пользователя root и ещё один пользователь Administrator, который включается в группу sudo, чтобы иметь возможность администрировать систему. Единственное, что нужно будет сделать вручную - это указать и разбить диск, на который ставится система. Но при желании и это можно автоматизировать. Однако, если в компьютере есть другие диски с данными, делать это нужно крайне внимательно, чтобы случайно не удалить там рабочие разделы. Инструкции и более полный пример такого файла можно найти здесь:
https://d-i.debian.org/doc/installation-guide/en.amd64/apbs04.html
https://d-i.debian.org/doc/installation-guide/example-preseed.txt
https://preseed.debian.net/debian-preseed/
С учётом этих инструкций, файл ответов можно модифицировать, вплоть до настройки отдельных пакетов, получив на выходе полностью готовую к работе систему. Но придётся повозиться и поэкспериментировать.
Данный файл ответов подходит в неизменном виде, пожалуй, только для домашнего использования. В корпоративной среде придётся изменить его с учётом требований безопасности. В частности, как минимум, зашифровать пароль root и подумать о том, в какие группы включать создаваемых на этапе установки пользователей.
В последней секции "Advanced options" в файл sources.list прописываются стандартные сетевые репозитории для текущей версии Debian. Если этого не сделать,файл окажется пустым и его придётся формировать вручную. Почему Debian при установки не из сети не создаёт такой файл сам, для меня загадка.
Теперь самое главное - нужно указать инсталлятору, чтобы он подхватил этот файл ответов при установке системы. Сделать это можно несколькими способами:
Выбор конфигурационного файла preseed.cfg вручную:
положить файл preseed.cfg в корень флешки
выбрать в меню установки Advanced options ...
выбрать ... Graphical automated install
когда установка дойдёт до выбора файла preseed.cfg в строке набрать: file:///cdrom/preseed.cfg (именно так - cdrom, хотя установка идёт с usb-носителя).
Выбор конфигурационного файла preseed.cfg автоматически:
положить файл preseed.cfg в корень флешки
для UEFI загрузки внести изменения в файл на флешке boot/grub/grub.cfg:
menuentry --hotkey=g 'Graphical install' {
set background_color=black
linux /install.amd/vmlinuz preseed/file=/cdrom/preseed.cfg locale=ru_RU.UTF-8 keymap=ru language=ru keyboard-configuration/toggle=Alt+Shift country=RU vga=788 --- quiet
initrd /install.amd/gtk/initrd.gz
}
или то же самое для секции 'Install', если нужна не графическая установкадля BIOS загрузки внести изменения в файл isolinux/txt.cfg:
label install
menu label ^Install
kernel /install.amd/vmlinuz
append preseed/file=/cdrom/preseed.cfg locale=ru_RU.UTF-8 keymap=ru language=ru keyboard-configuration/toggle=Alt+Shift country=RU vga=788 initrd=/install.amd/initrd.gz --- quiet
Выбор конфигурационного файла preseed.cfg с помощью Ventoy:
положить файл preseed.cfg в папку на диске Ventoy
настроить работу с файлом ответов в плагине автоматической установки (VentoyPlugson.exe)
(Что нужно добавить в уже имеющиеся на флешке файлы, выделено жирным).
После этих действий файл ответов подключится и Debian установится на компьютер.
На самом деле, разместить файл ответов можно и не на инсталляционном носителе, но тогда придётся экспериментально подбирать путь, который устроит инсталлятор.