银河麒麟高级服务器操作系统V10SP3 2403(X86)PXE服务端部署以及测试
银河麒麟高级服务器操作系统V10SP3 2403(X86)PXE服务端部署以及测试
- 一 系统环境
- 1.1 服务端/客户端系统版本
- 1.2 服务端环境信息
- 二 组件安装部署
- 2.1 安装软件包
- 2.1.1 uefi配置
- 2.1.2 legacy配置
- 2.2 dhcp服务配置
- 2.2.1 uefi配置
- 2.2.2 legacy配置
- 2.3 xinetd服务配置
- 2.4 http服务配置
- 2.4.1 uefi配置
- 2.4.2 legacy配置
- 2.5 grub配置
- 2.5.1 uefi配置
- 2.5.2 legacy安装
- 2.6 ks文件配置
- 2.8 重启服务
- 2.9 客户端测试
本文介绍在麒麟服务器操作系统上部署PXE服务端,集成麒麟系统安装源,TFTP服务,DHCP服务,HTTP服务,能够向客户机裸机发送PXE引导程序、Linux内核、启动菜单等数据,以及提供安装文件。
系统引导模式分为uefi引导以及legacy引导,文档内容均有列出。
一 系统环境
1.1 服务端/客户端系统版本
############## Kylin Linux Version #################
Release:
Kylin Linux Advanced Server release V10 (Halberd)Kernel:
4.19.90-89.26.v2401.ky10.x86_64Build:
Kylin Linux Advanced Server
release V10 SP3 2403/(Halberd)-x86_64-Build20/20240426
#################################################
1.2 服务端环境信息
IP地址: 192.168.13.12
子网掩码:255.255.255.0
网关: 192.168.134.2
分配的地址段:192.168.13.{200-210}
uefi引导需要的文件:grubx64.efi
legacy引导需要的文件:pxelinux.0
ISO镜像位置:Kylin-Server-V10-SP3-2403-Release-20240426-x86_64.iso
二 组件安装部署
2.1 安装软件包
2.1.1 uefi配置
yum install dhcp tftp tftp-server httpd xinetd rsync -y
2.1.2 legacy配置
yum install dhcp tftp tftp-server httpd xinetd syslinux-nonlinux rsync -y
2.2 dhcp服务配置
2.2.1 uefi配置
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
filename "grubx64.efi";
next-server 192.168.13.12;subnet 192.168.13.0 netmask 255.255.255.0 {option routers 192.168.13.2;option subnet-mask 255.255.255.0;range dynamic-bootp 192.168.13.200 192.168.13.210;default-lease-time 21600;max-lease-time 43200;
}
2.2.2 legacy配置
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
filename "pxelinux.0";
next-server 192.168.13.12;subnet 192.168.13.0 netmask 255.255.255.0 {option routers 192.168.13.2;option subnet-mask 255.255.255.0;range dynamic-bootp 192.168.13.200 192.168.13.210;default-lease-time 21600;max-lease-time 43200;
}
2.3 xinetd服务配置
/etc/xinetd.d/tftp文件中:disable yes改成no
2.4 http服务配置
2.4.1 uefi配置
(1)创建kylin和ks目录,用来存放安装源和ks文件
mkdir /var/www/html/kylin
mkdir /var/www/html/ks
mount Kylin-Server-V10-SP3-2403-Release-20240426-x86_64.iso /mnt/
rsync -a /mnt/ /var/www/html/kylin
chmod -R 755 /var/www/html/(2)将客户端启动引导所需文件拷贝至/var/lib/tftpboot/目录下
cp -rf /mnt/images/pxeboot/* /var/lib/tftpboot/
cp /mnt/EFI/BOOT/* /var/lib/tftpboot/
chmod 755 /var/lib/tftpboot/*
2.4.2 legacy配置
(1)创建kylin和ks目录,用来存放安装源和ks文件
mkdir /var/www/html/kylin
mkdir /var/www/html/ks
mount Kylin-Server-V10-SP3-2403-Release-20240426-x86_64.iso /mnt/
rsync -a /mnt/ /var/www/html/kylin
chmod -R 755 /var/www/html/(2)将客户端启动引导所需文件拷贝至/var/lib/tftpboot/目录下
cp -f /mnt/isolinux/* /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg
cp -f /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
chmod -R 755 /var/lib/tftpboot/*
2.5 grub配置
2.5.1 uefi配置
[root@localhost ~]# vim /var/lib/tftpboot/grub.cfg
set default="0"function load_video {insmod efi_gopinsmod efi_ugainsmod video_bochsinsmod video_cirrusinsmod all_video
}load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2set timeout=60
### END /etc/grub.d/00_header ###search --no-floppy --set=root -l 'Kylin-Server-10'menuentry 'Install Kylin Linux Advanced Server V10 HTTP' --class red --class gnu-linux --class gnu --class os {set root=(tftp,192.168.13.12)linux /vmlinuz ro inst.geoloc=0 console=ttyAMA0 console=tty0 rd.iscsi.waitnet=0 ip=dhcp inst.repo=http://192.168.13.12/kylin inst.ks=http://192.168.13.12/ks/kylin-ks.cfginitrd /initrd.img
}
2.5.2 legacy安装
default vesamenu.c32
timeout 100
display boot.msg# Clear the screen when exiting the menu, instead of leaving the menu displayed.
# For vesamenu, this means the graphical background is still displayed without
# the menu itself for as long as the screen remains in graphics mode.
menu clear
menu background splash.png
menu title Kylin Linux Advanced Server V10
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13# Border Area
menu color border * #00000000 #00000000 none
# Selected item
menu color sel 0 #ffffffff #00000000 none
# Title bar
menu color title 0 #ff7ba3d0 #00000000 none
# Press [Tab] message
menu color tabmsg 0 #ff3a6496 #00000000 none
# Unselected menu item
menu color unsel 0 #84b8ffff #00000000 none
# Selected hotkey
menu color hotsel 0 #84b8ffff #00000000 none
# Unselected hotkey
menu color hotkey 0 #ffffffff #00000000 none
# Help text
menu color help 0 #ffffffff #00000000 none
# A scrollbar of some type? Not sure.
menu color scrollbar 0 #ffffffff #ff355594 none
# Timeout msg
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none
# Command prompt text
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none
# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.
menu tabmsg Press Tab for full configuration options on menu items.
menu separator # insert an empty line
menu separator # insert an empty line
label httpmenu label ^Install Kylin Linux Advanced Server V10 HTTPmenu defaultkernel vmlinuzappend initrd=initrd.img ro inst.geoloc=0 console=ttyAMA0 console=tty0 rd.iscsi.waitnet=0 ip=dhcp inst.repo=http://192.168.13.12/kylin inst.ks=http://192.168.13.12/ks/kylin-ks.cfg
menu end
2.6 ks文件配置
[root@localhost ~]# cat /var/www/html/ks/kylin-ks.cfg
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --startxonboot
# Keyboard layouts
# old format: keyboard us
# new format:
keyboard --vckeymap=cn --xlayouts='cn'
# Root password
rootpw --iscrypted $1$CtjaC3gR$wwKd6TWI6Kd4PndMa84/M.
# Use network installation
url --url="http://192.168.13.12/kylin"
# System language
lang zh_CN
user --name=kylin --password=$6$M50j65Pr5.exzlyp$1Da/aWH2tpR4YLZxV/VO4fY06v8fvpd0CivRKMS6LmxtQEtHOppdvqWh0ZeZUfzfyrYeCc/IcGLI2AlTZ4xDp0 --iscrypted --gecos="kylin"
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
# SELinux configuration
selinux --disabled
reboot
# System services
services --enabled="chronyd"
ignoredisk --only-use=sda
# Firewall configuration
firewall --disabled
# Network information
network --bootproto=dhcp --device=None
# Halt after installation
halt
# System timezone
timezone Asia/Shanghai
# System bootloader configuration
bootloader --append="crashkernel=auto" --location=mbr --boot-drive=sda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel --drives=sda
# Disk partitioning information
part /boot --fstype="xfs" --ondisk=sda --size=1024
part /boot/efi --fstype="efi" --ondisk=sda --size=1024 --fsoptions="umask=0077,shortname=winnt"
part pv.789 --fstype="lvmpv" --ondisk=sda --grow --size=1
volgroup vg00 --pesize=4096 pv.789
logvol / --fstype="xfs" --size=30720 --name=lv_root --vgname=vg00
logvol /var --fstype="xfs" --size=30720 --name=lv_var --vgname=vg00
logvol /home --fstype="xfs" --size=15360 --name=lv_home --vgname=vg00
logvol /tmp --fstype="xfs" --size=25600 --name=lv_tmp --vgname=vg00
logvol swap --fstype="swap" --size=10240 --name=lv_swap --vgname=vg00%packages
@^server-product-environment
@development
@hardware-monitoring
@headless-management
@legacy-unix
@performance
@remote-system-management
@scientific
@security-tools
@system-tools%end
2.8 重启服务
systemctl enable httpd && systemctl restart httpd
systemctl enable dhcpd && systemctl restart dhcpd
systemctl enable xinetd && systemctl restart xinetd
systemctl enable tftp && systemctl restart tftp
systemctl disable firewalld && systemctl stop firewalld
