国产麒麟系统PXE安装-UEFI引导


国产麒麟系统PXE安装-UEFI引导

注意:

适用uefi引导

适用x86_64架构

一键部署脚本

1.上传ISO到PXE服务器,拷贝ISO文件

mkdir /kylin_isomount -o loop Kylin-Server-10-SP1-Release-Build04-20200711-x86_64.iso /kylin_iso/

2.配置http,获取安装源

yum -y install httpdmkdir /var/www/html/{ks,kylin}# 注意一定是"/kylin_iso/",两边的斜杠都要有rsync -a /kylin_iso/ /var/www/html/kylin/chmod -R 755 /var/www/html/kylin

3.配置dhcp,获取ip

yum -y install dhcpcat >/etc/dhcp/dhcpd.conf <<-EOF
ddns-update-style interim;ignore client-updates;#此filename文件在EFI/BOOT下filename "grubx64.efi";next-server 172.28.28.20;subnet 172.28.28.0 netmask 255.255.255.0 {
	option routers 172.28.28.254;
	option subnet-mask 255.255.255.0;
	range dynamic-bootp 172.28.28.30 172.28.28.60;
	default-lease-time 21600;
	max-lease-time 43200;}EOF

4.配置tftp,获取引导文件

4.1安装tftp,拷贝文件

yum -y install tftp tftp-server xinetd
# 修改/etc/xinetd.d/tftp文件,将disable=yes改为disable=no
rm -rf /var/lib/tftpboot/*
cp -rf /kylin_iso/images/pxeboot/* /var/lib/tftpboot/
cp -f /kylin_iso/EFI/BOOT/grub*.efi /var/lib/tftpboot

[object Object]

4.2编写grub.cfg文件

拷贝镜像文件中的EFI/BOOT/grub.cfg文件修改也行,自己写也行

cat > /var/lib/tftpboot/grub.cfg << -EOFset default="0"function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_videoelse
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrusfi}load_videoset gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2set timeout=10### BEGIN /etc/grub.d/10_linux ###menuentry 'Install Kylin Linux Advanced Server V10 HTTP' --class red --class gnu-linux --class gnu --class os {
set root=(tftp,172.28.28.20)
linux /vmlinuz ro inst.geoloc=0 console=ttyAMA0 console=tty0 rd.iscsi.waitnet=0 ip=dhcp inst.repo=http://172.28.28.20/kylin inst.ks=http://172.28.28.20/ks/kylin-ks.cfg rd.debug rd.udev.debug systemd.log_level=debug
initrd /initrd.img}EOF######################################################################## cp -f /var/lib/tftpboot/grub.cfg /var/www/html/kylin/EFI/BOOT/grub.cfg

5.配置kickstart文件

# 编写root加密密码脚本cat > /tmp/rootpw.py <<-EOF		#!/usr/bin/python2
		import crypt
		print(crypt.crypt("qwer1234!@#$"))EOF# python2 /tmp/rootpw.py | sed 's/\$/\\\$/g' | sed 's/.$//'# 将下边这一串复制,在kickstart文件里用\$6\$.dYjy61TQENBOxWh\$vlqi3zplBmmstY.3KefwcoAiOzOcEIj3JA717ikPuevNFdTnhX9pVGMApPU3mu2G54GbJwyKnFUBi48sFxrel

在这里插入图片描述

# mkdir /var/www/html/ks####################################################################### cat > /var/www/html/ks/kylin-ks.cfg << -EOF#Installation disksignoredisk --only-use=sda
autopart --type=lvm#Partition clearing informationclearpart --drives=sda --all --initlabel#Use graphical installgraphical#Keyboard layoutskeyboard --vckeymap=cn --xlayouts='cn'#System languagelang zh_CN.UTF-8#Network infotmationnetwork --bootproto=dhcp --device=ens33 --ipv6=auto --activate#network--bootproto=static --device=ens33 --gateway=172.28.28.254 --ip=172.28.28.20 --nameserver=114.114.114.114,8.8.8.8 --netmask=255.255.255.0 --ipv6=auto --activatenetwork --hostname=pxe-test1#Run the setup agent on first bootfirstboot --disable#X windows system configutation informationxconfig --startxonboot
skipx#eula --agreed#System servicesservices --enabled="chronyd"#System timezonetimezone Asia/Shanghai --isUtc#Environment groups#Minimal Install/最小安装#Server/基础设施服务器#File and Print Server/文件及打印服务器#Basic Web Server/基本网页服务器#Virtualization Host/虚拟化主机#Server with UKUI GUI/带 UKUI GUI 的服务器%packages
@^Minimal Installwgetbash-completion
%end#Root passwordrootpw --iscrypted $6$ERDzLOaKy1c0fk3P$IzOQAciOaQM59IEeJ9XlXJjGn71C1on2msh5m2zgmjPNNAf6Ukju8u5RlNeQNpgbmsxBBoCE5V.N7WtNS/X2R/#Password policies%anaconda
pwpolicy root --minlen=8 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=8 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=8 --minquality=1 --notstrict --nochanges --notempty
%endrebooteula --agreed
%post#Get kyinfowget http://172.28.28.20/kylin/{.kyinfo,LICENSE} --random-wait --directory-prefix /etc/#Enable kdumpsed -i "s/ crashkernel=auto / /" /boot/efi/EFI/BOOT/kylin/grub.cfg
%end
EOF# chmod -R 755 /var/www/html/ks

6.启动各服务

systemctl start httpd
systemctl start dhcpd
systemctl start tftp
systemctl start xinetd

广东林泽科技股份有限公司

GuangZhou LinZe Technology Co.,LTD.

全国免费服务电话:4008-520-866

电话:020-85260789   13902308107     微信号:2278502152

总部地址:广州市高新技术产业开发区彩频路9号304

工厂地址:广州市南沙区骏马大道19号斯泰克科创中心1号楼8层


现在注册,即刻畅享专业桌面虚拟化解决方案 立即注册