💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
# :-: PXE部署实施 | 适用范围 | 适用版本 | 人员 | 发布时间 | 文档版本 |备注 | | --- | --- | --- | --- | --- |--- | | 服务器操作系统 | V10-SP1-0518 | 鲍佳毅 |2022.3.4| V1.0|发布| | 服务器操作系统 | V10-SP1-0518 | 张志勇 |2022.3.4| V1.1|模板调整| ***** ### 该方案在 Kylin-Server-10-SP1-Release-Build20-20210518-x86_64-2021-05-18系统中测试; ### 方案中安装软件执行命令:rpm -ivh *.rpm ## PXE服务器配置 `systemctl stop firewalld` `systemctl disable firewalld` 需要先安装dhcp,httpd,xinetd服务   `setenforce 0` `iptables -F` `vim /etc/dhcp/dhcpd.conf` ``` option domain-name "example.org"; option domain-name-servers ns1.example.org, ns2.example.org; default-lease-time 600; max-lease-time 7200; log-facility local7; subnet 192.168.182.0 netmask 255.255.255.0 {     range 192.168.182.200 192.168.182.220;     option routers 192.168.182.250;     option domain-name-servers 8.8.8.8; } ``` `service dhcpd restart` `service dhcpd status` 输出结果显示正常运行 `systemctl enable xinetd.service` `systemctl enable tftp.service` `systemctl restart NetworkManager` `ls /tmp` 该目录下无bao.txt文档 `cd /var/lib/tftpboot/` `touch bao.txt` `cd /tmp` `tftp 192.168.182.213`(主机所在ip地址) `tftp >get bao.txt` `tftp >q` `ls /tmp` 返回结果有bao.txt 这里我们可以看到能够通过tftp将/var/lib/tftpboot/ 的文件下载到/tmp下说明tftp配置成功。 `rm -rf /var/lib/tftpboot/test.txt` 删除测试文件 准备pxe需要的相关文件 /home/bao/images是开始挂载iso文件的位置 `cp /home/bao/images/pxeboot/* /var/lib/tftpboot/` `mkdir /var/lib/tftpboot/pxelinux.cfg/` `cp /home/bao/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default` 通过这个 default 文件告诉客户机从什么内核引导, 以及在引导时向内核传递的任何选项 准备安装树 `mkdir /var/www/html/installtree/ ` `mount /dev/cdrom /var/www/html/installtree/` `service httpd restart` ![](https://img.kancloud.cn/37/56/375617b097d57c2b8ac8c4bce4e776d4_492x455.png) 准备kickstart文件 `cd /var/www/html` `mkdir ks` 将kick.cfg文件放在/var/www/html/ks目录下 `chmod -R +r ks` `chmod +x ks` 修改vim /var/lib/tftpboot/pxelinux.cfg/default文件 ``` menu rows 18 menu margin 8 #menu hidden menu helpmsgrow 15 menu tabmsgrow 13 menu width 80 menu color border * #00000000 #00000000 none menu color sel 0 #ffffffff #00000000 none menu color tabmsg 0 #ff3a6496 #00000000 none menu color unsel 0 #84b8ffff #00000000 none menu color hotsel 0 #84b8ffff #00000000 none menu color hotkey 0 #ffffffff #00000000 none menu color help 0 #ffffffff #00000000 none menu color scrollbar 0 #ffffffff #ff355594 none menu color timeout 0 #ffffffff #00000000 none menu color timeout_msg 0 #ffffffff #00000000 none menu color cmdmark 0 #84b8ffff #00000000 none menu color cmdline 0 #ffffffff #00000000 none menu tabmsg Press Tab for full configuration options on menu items. menu separator # insert an empty line menu separator # insert an empty line label linux   menu default   menu label ^Install Kylin Linux Advanced Server V10   kernel vmlinuz   append initrd=initrd.img repo=http://192.168.182.174/installtree/ ks=http://192.168.182.174/ks/ks.cfg ``` `vim /var/www/html/ks/ks.cfg` ``` # cat anaconda-ks.cfg #version=DEVEL # System authorization information auth --enableshadow --passalgo=sha512 # Install OS instead of upgrade install # Use network installation url --url="http://192.168.182.174/installtree/" #nfs --server=172.16.10.10 --dir=/install # Use text mode install text # Firewall configuration firewall --disabled firstboot --disable ignoredisk --only-use=sda lang zh_CN.UTF-8 --addsupport=en_US.UTF-8 # Network information network --bootproto=dhcp --device=ens33 --onboot=off --ipv6=auto --no-activate network --hostname=localhost.localdomain # Root password rootpw --iscrypted $6$5sDNTRTbeYH6QREp$RAzrxP8J2Ld/g9yMW8Qlcwn4zuX.SJkELxv89ZiKUgCiX9Ggyq9ZSPmkw7OL/HlGJUWk3orXbws74tPUDNFSo/ # Run the Setup Agent on first boot firstboot --disable # Do not configure the X Window System skipx # System services services --enabled="chronyd" # System timezone timezone Asia/Shanghai --isUtc # Disk partitioning information #System bootloader configuration bootloader --location=mbr --append="crashkernel=auto biosdevname=0 audit=0" zerombr clearpart --all --initlabel #Wirte out partition scheme based on EFI or not EFi part /boot --asprimary --fstype="xfs" --size=1000 part swap --fstype="swap" --size=1000 part / --asprimary --fstype="xfs" --grow --size=16000 %post --nochroot #####copy kyinfo and LICENSE if [ -e /tmp/.kyinfo ];then echo y | cp -a /tmp/.kyinfo $ANA_INSTALL_PATH/etc/ fi if [ -e /tmp/LICENSE ];then echo y | cp -a /tmp/LICENSE $ANA_INSTALL_PATH/etc/ fi if [ -e /run/install/repo/.kyinfo ];then echo y | cp -a /run/install/repo/.kyinfo $ANA_INSTALL_PATH/etc/ fi if [ -e /run/install/repo/LICENSE ];then echo y | cp -a /run/install/repo/LICENSE $ANA_INSTALL_PATH/etc/ fi ##### kylin postaction ## cdrom install, copy .kylin-post-actions if [ -e /run/install/repo/.kylin-post-actions ];then echo y | cp -a /run/install/repo/.kylin-post-actions /tmp/.kylin-post-actions echo "repo=/run/install/repo" > /tmp/.kylin-repo fi ## copy kylin post scripts in new os if [ -e /tmp/.kylin-post-actions ];then echo y | cp -a /tmp/.kylin-post-actions $ANA_INSTALL_PATH/bin fi if [ -e /tmp/.kylin-repo ];then echo y | cp -a /tmp/.kylin-repo $ANA_INSTALL_PATH/tmp/ fi ## copy and run .kylin-post-actions-nochroot if [ -e /run/install/repo/.kylin-post-actions-nochroot ];then echo y | cp -a /run/install/repo/.kylin-post-actions-nochroot /tmp/.kylin-post-actions-nochroot fi if [ -e /tmp/.kylin-post-actions-nochroot ];then /bin/bash -x /tmp/.kylin-post-actions-nochroot &> $ANA_INSTALL_PATH/var/log/.kylin-post-actions-nochroot.log fi %end %post ``` `systemctl disable systemd-networkd-wait-online.service` `systemctl disable multipathd.service` ``` ### do kylin post action if [ -e /bin/.kylin-post-actions ];then /bin/bash -x /bin/.kylin-post-actions &> /var/log/.kylin-post-actions.log fi %end %packages @^minimal-environment kexec-tools %end %addon com_redhat_kdump --enable --reserve-mb='auto' %end ``` ## PXE客户端配置 客户端的bios改成通过网络启动即可 参考文档 https://blog.csdn.net/weixin_44983653/article/details/102539178