ipxe autoinstall debian12.4
配置文件
目录结构
使用镜像源
mount -o loop /root/debian-12.4.0-amd64-DVD-1.iso /var/www/html/debian/
# /var/www/html
[root@localhost html]# tree -L 2
.
├── debian
├── ipxe
│ ├── boot.ipxe
│ ├── initrd.gz
│ ├── ipxe.efi
│ ├── linux
│ └── undionly.kpxe
└── preseed.cfg
initrd.gz 改动
- 添加 scsi-modules
-
修改 /usr/share/debconf/confmodule
# 第四行添加 忽略源gpg报错 [ -f /usr/lib/apt-setup/generators/50mirror ] && \ sed -i 's/trusted=""/trusted="[trusted=yes] "/g' /usr/lib/apt-setup/generators/50mirror
boot.ipxe
#!ipxe
kernel http://192.168.1.11/ipxe/linux vga=788 auto=true priority=critical preseed/url=http://192.168.1.11/preseed.cfg
initrd http://192.168.1.11/ipxe/initrd.gz
boot
preseed.cfg
### 本地化
# 语言
d-i debian-installer/locale string en_US
### 键盘
d-i keyboard-configuration/xkb-keymap select us
### 网络
d-i netcfg/choose_interface select auto
d-i netcfg/enable boolean true
### Mirror
d-i mirror/country string manual
d-i mirror/http/hostname string 192.168.1.11
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
### Account setup
d-i passwd/root-login boolean false
d-i passwd/user-fullname string user
d-i passwd/username string user
d-i passwd/user-password password 123
d-i passwd/user-password-again password 123
### 时区
d-i clock-setup/utc boolean true
d-i time/zone string Asia/Shanghai
d-i clock-setup/ntp boolean true
### 分区
d-i partman-auto/disk string /dev/sda
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-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
### Apt setup
d-i apt-setup/non-free boolean false
d-i apt-setup/contrib boolean false
d-i apt-setup/services-select multiselect main
d-i debian-installer/allow_unauthenticated boolean true
### Package selection
tasksel tasksel/first multiselect standard cinnamon-desktop
# 选择桌面环境
d-i pkgsel/upgrade select none
d-i pkgsel/language-packs multiselect en, zh
d-i pkgsel/update-policy select none
# d-i pkgsel/include string nano
### Boot loader installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string default
### Finishing up the installation
d-i finish-install/keep-consoles boolean true
dnsmasq
安装
yum install -y dnsmasq httpd
配置
dnsmasq.conf
[root@localhost html]# grep -Ev '^#|^$' /etc/dnsmasq.conf
conf-dir=/etc/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig
bind-interfaces
dhcp-range=192.168.1.200,192.168.1.250,255.255.255.0,8h
dhcp-option=option:router,192.168.1.2
dhcp-option=option:dns-server,223.5.5.5,223.6.6.6
enable-tftp
tftp-root=/var/www/html/ipxe
dhcp-match=set:bios,option:client-arch,0
dhcp-match=set:ipxe,175
dhcp-boot=tag:!ipxe,tag:bios,undionly.kpxe
dhcp-boot=tag:!ipxe,tag:!bios,ipxe.efi
dhcp-boot=tag:ipxe,boot.ipxe
httpd
rm /etc/httpd/conf.d/welcome.conf
添加配置文件
1. 上传 ipxe-debian12.4.tar.xz
2. 解压
tar xf ipxe-debian12.4.tar.xz -C /var/www/html
3. 修改 ip
[root@localhost html]# grep -r 192.168.1.11 .
./ipxe/boot.ipxe:kernel http://192.168.1.11/ipxe/linux vga=788 auto=true priority=critical preseed/url=http://192.168.1.11/preseed.cfg
./ipxe/boot.ipxe:initrd http://192.168.1.11/ipxe/initrd.gz
./preseed.cfg:d-i mirror/http/hostname string 192.168.1.11
启动
systemctl start httpd
systemctl start dnsmasq
评论