Modify an existing CD image to preseed d-i
Create copy of image
Hack the initrd
Fix md5sum's
Create new image
Sample preseed file
Create copy of image
#mount -o loop debian-7.5.0-amd64-CD-1.iso /mnt
#mkdir Debian7x64
#rsync -a -H --exclude=TRANS.TBL /mnt Debian7x64
#umount /mnt
Hack the initrd
# mkdir irmod
# cd irmod
# gzip -d < ../Debian7x64/install.amd/initrd.gz | cpio --extract --verbose --make-directories --no-absolute-filenames
# cp ../preseed.cfg preseed.cfg
# find . | cpio -H newc --create --verbose | gzip -9 > ../Debian7x64/install.amd/initrd.gz
# cd ../
# rm -fr irmod/
Fix md5sum's
# cd Debian7x64
# md5sum `find -follow -type f` > md5sum.txt
# cd ..
Create new image
# genisoimage -o Debian7x64_preseed_minimal_lvm.iso -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ./Debian7x64
Sample preseed file
#### Contents of the preconfiguration file (for wheezy)
### Localization
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/keymap select us
#d-i keymap select us
d-i keyboard-configuration/xkb-keymap select us
# Scan another CD or DVD?
apt-cdrom-setup apt-setup/cdrom/set-first boolean false
### Network configuration
d-i netcfg/choose_interface select auto
#d-i netcfg/get_hostname string localhost
#d-i netcfg/get_domain string localdomain.com
#d-i netcfg/hostname string localhost
### Mirror settings
d-i apt-setup/use_mirror boolean true
d-i mirror/protocol string http
d-i mirror/country string manual
d-i mirror/http/hostname string mirror.debian.vn
d-i mirror/http/directory string /debian
d-i mirror/suite string wheezy
d-i mirror/http/proxy string
### Account setup
d-i passwd/root-login boolean false
d-i passwd/make-user boolean true
d-i passwd/user-fullname string Test
d-i passwd/username string test
d-i passwd/user-password-crypted password $6$pp9kuTEa$4rIwzjBHUK0jyRC1vE73k7EdQWu8azUCPkwHNOf1BCcV9AC74RVMiGGxKgwn4nxL2GIGSh5orkA8qirDjkJTI1
d-i passwd/user-uid string 1000
d-i passwd/user-default-groups string sudo adm
### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string Asia/Ho_Chi_Minh
d-i clock-setup/ntp boolean true
### Partitioning
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-auto/choose_recipe select boot-root
d-i partman-auto-lvm/new_vg_name string system
d-i partman-auto/expert_recipe string \
boot-root :: \
100 100 200 ext4 \
$primary{ } \
$bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
1000 110 2000 ext4 \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
. \
1000 120 3000 ext4 \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /var } \
. \
500 130 1000 ext4 \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /var/lib/mysql } \
. \
500 140 1000 ext4 \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /www } \
. \
500 150 1000 ext4 \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
mountpoint{ /tmp } \
. \
2000 160 3000 ext4 \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /usr } \
. \
512 170 1000 linux-swap \
$lvmok{ } \
method{ swap } format{ } \
. \
2000 10 1000000000 ext4 \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
mountpoint{ /home } \
.
d-i partman/confirm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/device_remove_lvm boolean true
#d-i partman-lvm/confirm boolean true
d-i partman/choose_partition \
select Finish partitioning and write changes to disk
d-i partman/confirm_nooverwrite boolean true
d-i partman/mount_style select uuid
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-pc/install_devices multiselect /dev/sda
### Apt setup
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/services-select multiselect security, updates
d-i apt-setup/security_host string security.debian.org
d-i apt-setup/local0/repository string http://packages.dotdeb.org wheezy all
d-i apt-setup/local0/comment string Dotdeb
d-i apt-setup/local0/source boolean true
d-i apt-setup/local0/key string http://www.dotdeb.org/dotdeb.gpg
d-i apt-setup/local1/repository string http://packages.dotdeb.org wheezy-php55 all
d-i apt-setup/local1/comment string Dotdeb-PHP55
d-i apt-setup/local1/source boolean true
d-i apt-setup/local1/key string http://www.dotdeb.org/dotdeb.gpg
### Package selection
tasksel tasksel/first multiselect none
d-i pkgsel/include string openssh-server
d-i pkgsel/upgrade select none
popularity-contest popularity-contest/participate boolean false
### Misc options
# Disable that annoying WEP key dialog.
#d-i netcfg/wireless_wep string
# Allow non-free firmware
d-i hw-detect/load_firmware boolean true
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
No comments:
Post a Comment