Centos7.9搭建IPV6银河麒麟SP2系统PXE
一、环境准备
pxe-server 系统为CentOS 7.9
银河麒麟镜像名:Kylin-Server-10-SP2-x86-Release-Build09-20210524.iso
二、服务器部署
注意:配置环境之前请将防火墙关闭
1、配置DHCP分配网络网卡
cd/etc/sysconfig/network-scriptscatifcfg-ens192TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFROUTE=noIPV4_FAILURE_FATAL=noIPV6_AUTOCONF=yesIPV6_DEFROUTE=noIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens192UUID=f1d9d194-a609-4086-951b-2d955d64b43dDEVICE=ens192ONBOOT=yesIPADDR=192.168.40.1PREFIX=23IPV6INIT=yesIPV6ADDR=2001:8a2e:370::1/642、安装DHCP6、radvd 、TFTP、XINETD、HTTPD 服务
yuminstall-ydhcp6 radvd yuminstalltftp xinetd tftp-server –y yuminstall-yhttpd三、配置文件查看
1、配置radvd
cat/etc/radvd.conf# NOTE: there is no such thing as a working "by-default" configuration file.# At least the prefix needs to be specified. Please consult the radvd.conf(5)# man page and/or /usr/share/doc/radvd-*/radvd.conf.example for help.#interface ens192{AdvManagedFlag on;AdvSendAdvert on;AdvOtherConfigFlag on;AdvLinkMTU1480;MinRtrAdvInterval30;MaxRtrAdvInterval100;prefix2001:8a2e:370::1/64{AdvOnLink on;AdvAutonomous on;AdvRouterAddr on;};};2、DHCP6配置文件
cd/etc/dhcp/[root@localhost dhcp]# cat dhcpd6.confdefault-lease-time2592000;preferred-lifetime604800;option dhcp-renewal-time3600;option dhcp-rebinding-time7200;allow leasequery;option dhcp6.name-servers2001:8a2e:370::1;option dhcp6.domain-search"dhcpserver";option dhcp6.preference255;option dhcp6.rapid-commit;option dhcp6.info-refresh-time21600;dhcpv6-lease-file-name"/var/lib/dhcpd/dhcpd6.leases";subnet62001:8a2e:370::/64{range62001:8a2e:370::102001:8a2e:370::80;# range6 2001:8a2e:370::1 temporary;option dhcp6.bootfile-url"tftp://[2001:8a2e:370::1]/x86_uefi/grubx64.efi";}3、TFTP配置文件
cd/etc/xinetd.d/cattftp# default: off# description: The tftp server serves files using the trivial file transfer \# protocol. The tftp protocol is often used to boot diskless \# workstations, download configuration files to network-aware printers, \# and to start the installation process for some operating systems.servicetftp{disable=no socket_type=dgram protocol=udpwait=yesuser=root server=/usr/sbin/in.tftpd server_args=-s/var/lib/tftpboot per_source=11cps=1002flags=IPv4 flags=IPv6}4、 创建grub.cfg文件
进入/var/lib/tftpboot/
mkdir-px86_uefi/Kylin10-sp2-x86_64cp-r/mnt/EFI/BOOT/* /var/lib/tftpboot/x86_uefi/Kylin10-sp2-x86_64catgrub.cfgsetdefault="1"functionload_video{insmod efi_gop insmod efi_uga insmod video_bochs insmod video_cirrus insmod all_video}load_videosetgfxpayload=keep insmod gzio insmod part_gpt insmod ext2settimeout=600### END /etc/grub.d/00_header ####search --no-floppy --set=root -l 'CentOS 7 x86_64'### BEGIN /etc/grub.d/10_linux ###menuentry'Kylin-SP2-10'--classfedora--classgnu-linux--classgnu--classos{linuxefi x86_uefi/Kylin10-sp2-x86_64/vmlinuzinst.ks=http://[2001:8a2e:370::1]/ks/kylin-sp2.cfg quiet initrdefi x86_uefi/Kylin10-sp2-x86_64/initrd.img}}5、HTTP配置文件
上传银河麒麟SP2镜像
ll-lhKylin-Server-10-SP2-x86-Release-Build09-20210524.iso -rw-r--r--1root root4.1G Aug162021Kylin-Server-10-SP2-x86-Release-Build09-20210524.iso将镜像挂载到/mnt目录下mountKylin-Server-10-SP2-x86-Release-Build09-20210524.iso /mnt mount: /dev/loop2 is write-protected, mounting read-only进入/var/www/html/目录下创建镜像目录mkdir-p/os/Kylin10-sp2-x86_64cp-r/mnt/* /var/www/html/Kylin10-sp2-x86_64进入/var/www/html/目录下创建自动化部署脚本
mkdirks 上传kickstart文件catkylin-sp2.cfg#version=DEVEL# Use graphical installgraphical %post--nochroot#####copy kyinfo and LICENSEif[-e/tmp/.kyinfo];thenechoy|cp-a/tmp/.kyinfo$ANA_INSTALL_PATH/etc/fiif[-e/tmp/LICENSE];thenechoy|cp-a/tmp/LICENSE$ANA_INSTALL_PATH/etc/fiif[-e/run/install/repo/.kyinfo];thenechoy|cp-a/run/install/repo/.kyinfo$ANA_INSTALL_PATH/etc/fiif[-e/run/install/repo/LICENSE];thenechoy|cp-a/run/install/repo/LICENSE$ANA_INSTALL_PATH/etc/fi##### kylin postaction## cdrom install, copy .kylin-post-actionsif[-e/run/install/repo/.kylin-post-actions];thenechoy|cp-a/run/install/repo/.kylin-post-actions /tmp/.kylin-post-actionsecho"repo=/run/install/repo">/tmp/.kylin-repofi## copy kylin post scripts in new osif[-e/tmp/.kylin-post-actions];thenechoy|cp-a/tmp/.kylin-post-actions$ANA_INSTALL_PATH/binfiif[-e/tmp/.kylin-repo];thenechoy|cp-a/tmp/.kylin-repo$ANA_INSTALL_PATH/tmp/fi## copy and run .kylin-post-actions-nochrootif[-e/run/install/repo/.kylin-post-actions-nochroot];thenechoy|cp-a/run/install/repo/.kylin-post-actions-nochroot /tmp/.kylin-post-actions-nochrootfiif[-e/tmp/.kylin-post-actions-nochroot];then/bin/bash-x/tmp/.kylin-post-actions-nochroot&>$ANA_INSTALL_PATH/var/log/.kylin-post-actions-nochroot.logfi%end %post systemctl disable systemd-networkd-wait-online.service systemctl disable multipathd.service### do kylin post actionif[-e/bin/.kylin-post-actions];then/bin/bash-x/bin/.kylin-post-actions&>/var/log/.kylin-post-actions.logfi%end %packages @^minimal-environment @container-management @debugging @development @headless-management @legacy-unix @scientific @security-tools @smart-card @standard @system-tools %end# Keyboard layoutskeyboard--xlayouts='cn'# System languagelang zh_CN.UTF-8# Network informationnetwork--bootproto=dhcp--device=em1--onboot=off--ipv6=auto --no-activate network--bootproto=dhcp--device=em2--onboot=off--ipv6=auto--activatenetwork--bootproto=dhcp--device=enp0s20f0u7u2c2--onboot=off--ipv6=auto network--bootproto=dhcp--device=p10p1--onboot=off--ipv6=auto network--bootproto=dhcp--device=p10p2--onboot=off--ipv6=auto network--bootproto=dhcp--device=p10p3--onboot=off--ipv6=auto network--bootproto=dhcp--device=p10p4--onboot=off--ipv6=auto network--bootproto=dhcp--device=p9p1--onboot=off--ipv6=auto network--bootproto=dhcp--device=p9p2--onboot=off--ipv6=auto network--hostname=localhost.localdomain# Use CDROM installation mediaurl--url=http://[2001:8a2e:370::1]/os/Kylin10-sp2-x86_64# Run the Setup Agent on first bootfirstboot--enable# System servicesservices--enabled="chronyd"ignoredisk --only-use=sda autopart# Partition clearing informationclearpart--none--initlabel# System timezonetimezone Asia/Shanghai--utc# Root passwordrootpw--iscrypted$6$JawW/73frMubeXz7$j4T8xbOFktAxzIdACYeSLSUEjQ5NSVDNF7Jm0VDMzSIzEZ3IMLj75XCx90jdHv8PG4FRLlRVuRgc/RvGUGWRy. user--groups=wheel--name=yys--password=$6$r2rPhUp5qp99Fh0f$mKoXSqW1cjQKreqBhAJFOIQ1AttkQzAOBo0BoaL1O6nxAmsw5snxStFYG2WbnB2AZr.J3dMn4IptLtSpqms0K.--iscrypted--gecos="yys"%addon com_redhat_kdump--enable--reserve-mb='1024M'%end %anaconda pwpolicy root--minlen=8--minquality=1--strict--nochanges--notemptypwpolicy user--minlen=8--minquality=1--strict--nochanges--emptyokpwpolicy luks--minlen=8--minquality=1--strict--nochanges--notempty%end6、服务启动
systemctl restart dhcpd systemctl restart radvd systemctl restart tftp systemctl restart xinetd systemctl restart httpd四、验证部署测试
