Automated custom installation of Debian
1 Change the grub configuration file, modify the installation options for the system, load the installation configuration file (/boot/grub/grub.cfg)
if loadfont $prefix/font.pf2 ; then
set gfxmode=800x600
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod gfxterm
insmod png
terminal_output gfxterm
fi
if background_image /isolinux/splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
else
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
fi
insmod play
play 960 440 1 0 4 440 1
set theme=/boot/grub/theme/1
menuentry --hotkey=g 'Graphical install' {
set background_color=black
linux /install.amd/vmlinuz vga=788 --- quiet
initrd /install.amd/gtk/initrd.gz
}
menuentry --hotkey=i 'Install' {
set background_color=black
linux /install.amd/vmlinuz vga=788 --- quiet
initrd /install.amd/initrd.gz
}
##下面是自动化安装选项, file=/cdrom/debian8.ks加载的自动化安装配置文件
menuentry 'Install Debian Auto' {
set background_color=black
linux /install.amd/vmlinuz auto=true file=/cdrom/debian8.ks vga=788 --- quiet
initrd /install.amd/gtk/initrd.gz
}
2 Create automated installation configuration file debian8.ks
d-i debian-installer/locale string en_US
d-i debian-installer/language string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/supported-locales multiselect en_US.UTF-8 zh_CN.UTF-8
d-i console-setup/ask_detect boolean false
d-i console-setup/modelcode string pc105
d-i console-setup/layoutcode string us
d-i console-setup/variantcode string USA
d-i console-keymaps-at/keymap select us
d-i keyboard-configuration/xkb-keymap select us
d-i clock-setup/utc boolean true
d-i time/zone string Asia/Shanghai
d-i clock-setup/ntp boolean false
d-i clock-setup/ntp-server string cn.pool.ntp.org
d-i netcfg/choose_interface select auto
d-i netcfg/disable_dhcp boolean true
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/get_ipaddress string 10.0.0.111
d-i netcfg/get_nameservers string 10.0.0.1
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 10.0.0.1
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string ops.2233.tv
d-i netcfg/get_domain string
d-i netcfg/wireless_wep string
popularity-contest popularity-contest/participate boolean false
d-i partman-auto/method string regular
d-i partman-auto/disk string /dev/sda
d-i partman-auto/choose_recipe select All files in one partition (recommended for new users)
d-i partman-auto/method string regular
d-i partman/confirm boolean true
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select Finish partitioning and write changes to disk
d-i partman-lvm/confirm boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman/choose_partition select finish
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm_write_changes_to_disks_and_configure_lvm boolean true
apt-mirror-setup apt-setup/no_mirror boolean true
apt-mirror-setup apt-setup/use_mirror boolean false
apt-mirror-setup apt-setup/contrib boolean false
apt-mirror-setup apt-setup/non-free boolean false
apt-cdrom-setup apt-setup/cdrom/set-next boolean false
apt-setup-udeb apt-setup/services-select multiselect
# Need If using iso
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
d-i mirror/country string manual
d-i mirror/http/hostname string mirrors.aliyun.com
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
tasksel tasksel/first multiselect standard
popularity-contest popularity-contest/participate boolean false
d-i debian-installer/splash boolean true
d-i pkgsel/include string
d-i pkgsel/language-packs string
d-i pkgsel/install-language-support boolean false
d-i pkgsel/update-policy select unattended-upgrades
d-i pkgsel/upgrade select safe-upgrade
d-i passwd/root-login boolean true
d-i passwd/make-user boolean false
d-i passwd/root-password password 111111
d-i passwd/root-password-again password 111111
d-i user-setup/allow-password-weak boolean true
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string /dev/sda
d-i finish-install/keep-consoles boolean false
d-i finish-install/reboot_in_progress note
d-i cdrom-detect/eject boolean true
d-i debian-installer/exit/halt boolean false
d-i debian-installer/exit/poweroff boolean false
d-i cdrom-detect/eject boolean false
d-i preseed/early_command string anna-install some-udeb
d-i preseed/late_command string \
cp -r /cdrom/tools/* /target/opt/ ; \
cp /cdrom/aaa/* /target/etc/
3 Create boot from Kai Script
#!/bin/sh
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
##判断是否有/aaa目录,没有运行then 最后创建/aaa目录 判断是否需要执行命令
if [ ! -d "/aaa" ]; then
cd /opt
dpkg -i deb/*.deb
apt --fix-broken install -y
dpkg -i deb/python*
dpkg -i deb/gluster*
cp bin/MegaCli64 /sbin/
docker load < docker-images/mariadb.tar
docker load < docker-images/redis.tar
docker load < docker-images/mongo.tar
docker load < docker-images/rabbitmq.tar
cp config/nginx.conf /etc/nginx
cp config/rc.xml /etc/X11/openbox
cp config/slim.conf /etc/
cp config/sshd_config /etc/ssh
cp config/interfaces /etc/network/interfaces
cp tar/data.tar /
cp tar/pm2.tar /usr/lib/node_modules
cd /
tar -xf data.tar
rm /data.tar
cd /usr/lib/node_modules
tar -xf pm2.tar
npm build pm2 -g
rm /usr/lib/node_modules/pm2.tar
su -c 'export NODE_ENV=production && pm2 start /data/app/dcc/server/dist/main.js -n dcc' --login root
su -c 'export NODE_ENV=production && pm2 start /data/app/src/server/dist/main.js -n src' --login root
su -c 'export NODE_ENV=production && pm2 start /data/app/smi/server/dist/main.js -n smi' --login root
su -c 'pm2 startup' --login root
su -c 'pm2 save' --login root
mkdir /aaa
fi
exit 0
4 custom package, into the corresponding list means
Boot the system is the DVD that comes with the default will mount the CD under / cdrom directory, the system is installed to / target directory.
5 Replacing the guide background
/ isolinux directory under splash.png
auto-answer file .ks reference https://forum.ubuntu.org.cn/viewtopic.php?t=199876
https://blog.csdn.net/weixin_34279184/article/details/91744710