自动化脚本扣我

每一步可直接ctrl+cv

  • 1.上传ISO到PXE服务器,拷贝ISO文件
  • 2.配置http,获取安装源
  • 3.配置dhcp,获取ip
  • 4.配置tftp,获取引导文件
  • 5.配置kickstart文件
  • 6.启动各服务

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

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

2.配置http,获取安装源

yum -y install httpd
mkdir /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 dhcp
cat >/etc/dhcp/dhcpd.conf <<-EOF
ddns-update-style interim;
ignore client-updates;
#此filename文件在光盘里,包名叫:syslinux-nonlinux-6.04-5.ky10.noarch.rpm
filename "pxelinux.0";
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
systemctl start dhcpd
systemctl enable dhcpd

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

yum -y install tftp tftp-server xinetd
\cp -f /kylin_iso/isolinux/* /var/lib/tftpboot/
\cp -f /kylin_iso/images/pxeboot/* /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfgcat >/var/lib/tftpboot/pxelinux.cfg/default<<EOF
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 linelabel 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://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
menu end
EOF\cp -f /kylin_iso/Packages/syslinux-nonlinux-* /tmp
rm -rf /tmp/usr
cd /tmp
rpm2cpio /tmp/syslinux-nonlinux-* | cpio -idm --quiet
\cp -f /tmp/usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
chmod -R 755 /var/lib/tftpboot/

5.配置kickstart文件

cat >/var/www/html/ks/kylin-ks.cfg<<EOF
#Installation disks
ignoredisk --only-use=sda
autopart --type=lvm#Partition clearing information
clearpart --drives=sda --all --initlabel
#Use graphical install
graphical#Keyboard layouts
keyboard --vckeymap=cn --xlayouts='cn'#System language
lang zh_CN.UTF-8
#Network infotmation
network --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 --activate
network --hostname=pxe-test1#Run the setup agent on first boot
firstboot --disable#X windows system configutation information
xconfig --startxonboot
skipx#eula --agreed
#System services
services --enabled="chronyd"#System timezone
timezone 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 Install
wget
bash-completion
%end#Root password
rootpw --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
%end
reboot
eula --agreed
%post
#Get kyinfo
wget http://172.28.28.20/kylin/{.kyinfo,LICENSE} --random-wait --directory-prefix /etc/
#Enable kdump
sed -i "s/ crashkernel=auto / /" /boot/efi/EFI/BOOT/kylin/grub.cfg
%end
EOF

6.启动各服务

chmod -R 755 /var/www/html
chmod -R 755 /var/lib/tftpboot
systemctl restart httpd dhcpd tftp xinetd
sytemctl enable httpd dhcpd tftp xinetd

国产麒麟系统PXE安装-传统bios(legacy)引导相关推荐

  1. 国产麒麟系统一键部署PXE脚本传统BIOS(legacy)引导 仅供参考

    手动执行扣我 #!/bin/bash #Date:2022/3/18 #Func:一键部署pxe服务器 #Author:Hejing #Note:仅适用x86架构bios(legacy)安装PXE_S ...

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

    文章目录 1.上传ISO到PXE服务器,拷贝ISO文件 2.配置http,获取安装源 3.配置dhcp,获取ip 4.配置tftp,获取引导文件 4.1安装tftp,拷贝文件 4.2编写grub.cf ...

  3. 麒麟系统开发笔记(一):国产麒麟系统搭建开发环境之虚拟机安装

    若该文为原创文章,转载请注明原文出处 本文章博客地址:https://hpzwl.blog.csdn.net/article/details/123045165 红胖子(红模仿)的博文大全:开发技术集 ...

  4. 麒麟系统开发笔记(二):国产麒麟系统搭建Qt开发环境安装Qt5.12

    若该文为原创文章,转载请注明原文出处 本文章博客地址:https://hpzwl.blog.csdn.net/article/details/123840699 红胖子(红模仿)的博文大全:开发技术集 ...

  5. linux系统安装柯美打印机,柯尼卡美能达复印机中标麒麟系统驱动安装

    柯尼卡美能达复印机中标麒麟系统驱动安装 现在很多东西都在支持国产化,电脑和复印机等办公设备也不例外.下面广州柯镁为大家详细介绍,国产电脑芯片麒麟系统如何安装柯尼卡美能达打印机驱动. 柯尼卡美能达复印机 ...

  6. 关于 国产麒麟系统编译Qt项目是报错:error: cannot find -lGL 的解决方法

    若该文为原创文章,转载请注明原文出处 本文章博客地址:https://hpzwl.blog.csdn.net/article/details/123784051 红胖子(红模仿)的博文大全:开发技术集 ...

  7. [转帖]国产麒麟系统为何饱受争议?

    国产麒麟系统为何饱受争议?  ARM  4个月前 (01-11)  377浏览 https://www.veryarm.com 这里的银河麒麟 是2014年以前的了. 由国防科大开发的麒麟操作系统有很 ...

  8. 关于 国产麒麟系统运行Qt,在命令行可以运行而双击无法运行(无反应) 的解决方法

    若该文为原创文章,转载请注明原文出处 本文章博客地址:https://hpzwl.blog.csdn.net/article/details/125517555 红胖子(红模仿)的博文大全:开发技术集 ...

  9. 一声叹息:国产麒麟系统为何饱受争议?

    由国防科大开发的麒麟操作系统有很多,与国防科大混乱的CPU产品线一样,这些麒麟操作系统彼此之间技术延续性也有限,比较有名的是银河麒麟.优麒麟和中标麒麟操作系统. 另外,华为准备推出的可能被用于手机或物 ...

最新文章

  1. PHP如何进行错误与异常处理(PHP7中的异常处理和之前版本异常处理的区别)
  2. 《简明 PHP 教程》01 关于 PHP
  3. DDD理论学习系列(1)-- 通用语言
  4. 撰写第三周课程总结及实验报告(一)
  5. android 1396x750设计图,移动端的适配|切图|标注
  6. 移动开发平台性能比較
  7. 视频编码H.264的应用
  8. vbs当计算机重启,用vbs实现重新启动 Internet Explorer
  9. Junit4集成到Maven工程
  10. mysql中数据字典_MySQL8.0之数据字典
  11. Ununtu下安装搜狗拼音输入法
  12. 艺术字体手绘,如何进行创作呢
  13. 80C51单片机的基本信息
  14. excel如何打开100万行以上的csv文件
  15. 评估指标——均方误差(MSE)、平均绝对误差(MAE)
  16. AWS KMS加密和解密
  17. 在AD中添加logo
  18. java一元二次方程求解_求JAVA解一元二次方程的程序。
  19. 用c 语言循环抓取网页,C语言获取网页源代码
  20. BT5R3下安装metasploit

热门文章

  1. VSCode-工控机远程开发 之(一) VSCode无法连接扩展商店
  2. how can i check the error of Journal import date source
  3. Windows改装成Linux,Windows系统改装成Linux系统
  4. SQL注入点判断及万能密码
  5. 曾做erp开发工程师,谈下自己的经验
  6. python中flush什么意思_python flush()定义及作用详解(实例分析)
  7. 使用CenterNet训练自己的数据集
  8. 狂神说Linux笔记
  9. MATLAB如何解决弹出路径不存在的问题
  10. 《黑马程序员》通讯录管理系统实战