나는 다음 도구를 사용하여 Debian 10 stable("buster")의 사용자 정의 ISO 이미지를 만들고 있습니다:사전 방송, 내 사용자 정의 파일은 완벽하게 작동하지만 한 가지를 제외하고 는 새 시스템을 설치할 때마다 수동으로 이 작업을 수행할 필요가 없도록 원하는 저장소로 구성하고 preseed.cfg
싶습니다 ./etc/apt/sources.list
대상은 /etc/apt/sources.list
다음과 같습니다(여기서는 https가 필요합니다).
deb https://deb.debian.org/debian buster main contrib non-free
deb-src https://deb.debian.org/debian buster main contrib non-free
deb https://deb.debian.org/debian-security/ buster/updates main contrib non-free
deb-src https://deb.debian.org/debian-security/ buster/updates main contrib non-free
deb https://deb.debian.org/debian buster-updates main contrib non-free
deb-src https://deb.debian.org/debian buster-updates main contrib non-free
내 preseed.cfg
파일은 다음과 같습니다.
#### Contents of the preconfiguration file (for buster)
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US
# Keyboard selection.
d-i keyboard-configuration/xkb-keymap select us
# d-i keyboard-configuration/toggle select No toggling
### 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/hostname string vienna1-preseed
d-i netcfg/wireless_wep string
### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string http.us.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
### Account setup
d-i passwd/root-login boolean false
# To create a normal user account.
d-i passwd/user-fullname string theusername
d-i passwd/username string theusername
d-i passwd/user-password-crypted password $6$qVk198UWGPxpW$tzMYxQyiOrI4ClDJdDGALsyYq1j1IbXWbpem3JevFT9Krqdmt4wKdvtiY8ry3PRh277V6GHzSKP3zSI7jt04Y/
### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string US/Eastern
d-i clock-setup/ntp boolean true
### Partitioning
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
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/choose_recipe select atomic
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-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
# https://serverfault.com/a/622818
d-i apt-setup/use_mirror boolean false
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-next boolean false
d-i apt-setup/cdrom/set-failed boolean false
### Base system installation
# Configure APT to not install recommended packages by default. Use of this
# option can result in an incomplete system and should only be used by very
# experienced users.
#d-i base-installer/install-recommends boolean false
### 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
### Package selection
tasksel tasksel/first multiselect standard
d-i pkgsel/upgrade select full-upgrade
popularity-contest popularity-contest/participate boolean false
### Boot loader installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string default
d-i finish-install/reboot_in_progress note
d-i debian-installer/exit/poweroff boolean true
답변1
d-i preseed/late_command string
의 명령은 preseed.cfg
원하는 대로 수행됩니다. sources.list
ISO에 사용자 정의 파일을 추가한 다음 설치가 완료된 후 복사했습니다 . 에 다음 명령을 추가합니다 preseed.cfg
.
d-i preseed/late_command string \
cp sources.list /target/etc/apt/sources.list; \
in-target apt-get update; \
in-target apt-get install -y git;
마지막 두 명령은 패키지 목록을 업데이트하고 CD(git)에 포함되지 않은 패키지를 설치하는 방법을 보여줍니다.
preseed.cfg
new 및 new를 사용하여 iso 이미지를 빌드하는 방법은 다음과 같습니다 sources.list
.
#!/usr/bin/env bash
# Install dependencies
# sudo apt install isolinux syslinux-utils xorriso
cd ~
mkdir iso
xorriso -osirrox on -indev debian-10.2.0-amd64-netinst.iso -extract / iso/
chmod +w -R iso/install.amd/
gunzip iso/install.amd/initrd.gz
echo preseed.cfg | cpio -H newc -o -A -F iso/install.amd/initrd
echo sources.list | cpio -H newc -o -A -F iso/install.amd/initrd
gzip iso/install.amd/initrd
chmod -w -R iso/install.amd/
cd iso/
chmod +w md5sum.txt
md5sum `find -follow -type f` > md5sum.txt
cd ..
xorriso -as mkisofs -o 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 iso
이 스크립트는 여러분이 Debian 10 stable("buster") amd64를 사용하고 있고 이 preseed.cfg
파일이 sources.list
iso를 빌드하는 데 사용하는 시스템의 홈 디렉터리에 있다고 가정합니다.
답변2
d-i preseed/late_command string \
echo "{{source1}}" > /target/etc/apt/sources.txt; \
echo "{{source2}}" >> /target/etc/apt/sources.txt; \
echo "{{source3}}" >> /target/etc/apt/sources.txt; \
in-target mv /etc/apt/sources.txt /etc/apt/sources.list; \
in-target chmod 644 /etc/apt/sources.list; \
in-target apt update && apt-get dist-upgrade -y; \