ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

PXE 网络装机 - iventoy

2026/8/21 7:27:42 拓冰建站 浏览量
PXE 网络装机 - iventoy 一、需求介绍1、时间紧凑为应付到货验收机器早早发到现场人员仅有项目经理对于有休息日的朋友在周五赶上这种事情那无疑是令人难过的更别说让出差了iventoy可以帮助我们“躺平”2、经常装系统是枯燥乏味且重复的如何解放双手让我们干点更有价值的事iventoy 来解决这个问题二、网络装机和iventoy概念PXE服务的作用是PXE服务器开机时网卡通过 DHCP 为客户端分配IP地址通过tftp获取引导文件然后拿到服务端通过ftp或者http的相关系统镜像文件因为有了系统镜像文件所以也就有了内核和系统的引导文件最后成功进入系统安装页面。后续可结合ks文件写一套规则决定怎么分区安装前后要做什么等来实现无人值守。以前为了实现这个功能需要手动搭建各种服务踩坑无数但伟大的iventoy 工具让这一切直接封装成了黑盒子iventoy官方介绍如下iVentoy三、操作过程1、服务端配置官方提供了Linux和Windows的安装包以Windows为例下载好后直接双击exe文件即可如果双击一直没什么反应的话说明当前机器缺少VC的环境需要安装网上找一个VC_redist.x64.exe 的安装包进行使用就行winr 打开控制面板在安全里关闭防火墙完成后双击exe就能正常打开了如果依然不行试着在安全和维护中关闭相应的保护启动iventoy后程序会自动获取本机IP配置如果我们未配置本地IP有时软件会无法启动因为他无法获取本地网络配置成功启动后配置起始IP和结束IP参数配置的话一般选内部因为我需要在本机搭建PXE 然后为其他机器装环境所以本机就是DHCP服务器和PXE服务器MAC和用户过滤一般可以不配置点击镜像管理然后上传相关的iso启动服务2、客户端配置2.1 常规操作下位机开机进入BIOS研华DEL进入BIOSF7 进入启动菜单凯瑞DEL进入BIOSF11 进入启动菜单简仪DEL进入BIOSF7 进入启动菜单选择Network Stack Configuration开启PXE IPV4的功能有时需要配置PCH-IO Configuration否则后面启动项中不显示网卡CSM 保持默认就行一般是UEFIiventoy支持该模式保存退出后会自动重启机器按对应的按钮进入启动菜单并选择网口如果出现no media found 就说明网口插错了换一个试试如果出现了Start pxe ipv4 MAC地址就行过一会儿就会进入iventoy 引导后面就是正常进入系统安装页面安装就行2.2 无人值守在镜像管理我们可以看到自动安装脚本指定我们准备好的ks文件即可然后将默认自动脚本编号和超时时间写个数然后启动PXE服务这时候客户端再去连的时候会在选择系统后再选择一次ks文件即可开启自动化安装ks文件展示要说明的是install下的url 有时我们的系统启动可能会报错卡在 dracut-initqucuc这通常是因为找不到安装源导致的检查下服务端的IP 是否还在如我之前用过的1.29 是否在ipconfig下显示1.29 是否又能ping通dhcp分配给新机器的1.235 能通才能找到安装源。如果都能通的话在等待一会儿应该就可以进入系统安装页面#platformx86, AMD64, or Intel EM64T #versionDEVEL # Install OS instead of upgrade install url --urlhttp://192.168.1.29:16000/iso/centos7.9.iso # Keyboard layouts keyboard us # Root password rootpw --plaintext 123456 # System language lang en_US # System authorization information auth --useshadow --passalgosha512 # Use text mode install text firstboot --disable # SELinux configuration selinux --disabled # Firewall configuration firewall --disabled # Network information (Auto-detect interface, no hardcoded eth0) network --bootprotodhcp # Reboot after installation halt # System timezone timezone Asia/Shanghai # System bootloader configuration bootloader --appendnet.ifnames0 biosdevname0 --locationmbr # Clear the Master Boot Record zerombr # Partition clearing information (Dynamic disk detection) ignoredisk --only-use$$VT_LINUX_DISK_MAX_SIZE$$ clearpart --all --initlabel --drives$$VT_LINUX_DISK_MAX_SIZE$$ # Disk partitioning information part /boot/efi --fstypeefi --size1024 part /boot --fstypexfs --size1024 part pv.01 --fstypelvmpv --size1 --grow volgroup centos --pesize4096 pv.01 logvol / --vgnamecentos --nameroot --fstypexfs --size204800 logvol swap --vgnamecentos --nameswap --fstypeswap --size8192 # Pre-installation script (Dynamic disk wiping) %pre --interpreter/bin/bash DISK$$VT_LINUX_DISK_MAX_SIZE$$ lvm vgchange -ay 2/dev/null || true lvm vgremove -f centos 2/dev/null || true wipefs -a $DISK 2/dev/null || true %end # Post-installation script %post --interpreter/bin/bash exec /dev/tty1 21 # Disable unnecessary services systemctl disable --now kdump systemctl disable --now firewalld iptables -F # Set default target and create user systemctl set-default graphical.target useradd simpole echo 123456 | passwd --stdin simpole systemctl start sshd # Create software directory (No wget, just prepare the folder) mkdir -p /opt/software wget http://192.168.1.29:16000/user/installV1.9.zip -P /opt/software wget http://192.168.1.29:16000/user/glibc-2.17-317.el7.i686.rpm -P /opt/software wget http://192.168.1.29:16000/user/redhawk7.3.iso -P /opt/software wget http://192.168.1.29:16000/user/PM8222-SHBA.zip -P /opt/software # 安装补丁并编译内核 cd /opt/software/ rpm -ivh glibc-2.17-317.el7.i686.rpm --nodeps mount -o loop /opt/software/redhawk7.3.iso /mnt cd /mnt ./install-redhawk --auto #cd /opt/software/ unzip PM8222-SHBA.zip #rm -rf /usr/src/linux-4.4.60RedHawk7.3/drivers/scsi/Kconfig #rm -rf /usr/src/linux-4.4.60RedHawk7.3/drivers/scsi/Makefile #cp -ra /opt/software/PM8222-SHBA/Kernel_smartpqi-2.1.18-045/usr/src/linux-4.4.60RedHawk7.3/drivers/scsi/* /usr/src/linux-4.4.60RedHawk7.3/drivers/scsi/ date -s 2025-12-12 00:00:00 # 刷新时间避免卡死 # 安装DDS umount /mnt rm -rf /opt/software/redhawk7.3.iso cd /opt/software/ unzip installV1.9.zip cd /opt/software/installV1.9/ ./ddsInstall.sh 192.168.1.135 ./ddsUp.sh # 安装基础环境 #cd /opt/software/installV1.9/ #./INSTALL.sh 192.168.1.135 # 编译内核 cd /usr/src/linux-4.4.60RedHawk7.3/ find . -type f | xargs -n 5 touch cd /opt/software/installV1.9/ ./compileKernel.sh %end # Packages to be installed %packages ^developer-workstation-environment additional-devel backup-client base compat-libraries core debugging desktop-debugging development dial-up directory-client dns-server emacs file-server fonts ftp-server gnome-apps gnome-desktop graphics guest-agents guest-desktop-agents hardware-monitoring identity-management-server infiniband input-methods internet-applications internet-browser java-platform kde-desktop large-systems legacy-x load-balancer mail-server mainframe-access mariadb multimedia network-file-system-client office-suite performance perl-runtime perl-web php platform-devel postgresql print-client python-web ruby-runtime security-tools smart-card system-admin-tools technical-writing virtualization-client virtualization-hypervisor virtualization-tools web-server web-servlet x11 %end另外无人值守如果用到了wget 文件的操作我们的windows服务端一般是没有ftp和http服务的但是iventoy内置了http启动iventoy服务后我们可以在参数配置看到它访问本机 IP:端口/路径我在user下放了自己的数据可以用本机直接测试192.168.1.29:16000/user/installV1.9.zip 如果可以下载就说明服务是可行的也可以找一台其他机器使用wget http://192.168.1.29:16000/user/installV1.9.zip 进行测试四、总结iventoy确实省了不少事情只需一台windows、网线将设备互联、机器支持PXE大多数网卡都支持就可以很容易的完成系统搭建