首页 > 系统相关 >centos9上布置pxe+kickstart测试

centos9上布置pxe+kickstart测试

时间:2022-12-26 11:33:11浏览次数:35  
标签:bin none kickstart -- menu pxe centos9 c32

实验环境:vmware esxi6.7.0

纳管平台:vmware vcenter

1. 装包

yum -y install dhcp-server tftp httpd

2. 配置dhcp

[root@centos9 ~]# cat /etc/dhcp/dhcpd.conf
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#

log-facility local7;

# A slightly different configuration for an internal subnet.
subnet 192.168.116.0 netmask 255.255.255.0 {
  range 192.168.116.10 192.168.116.20;
  option domain-name-servers ks.pxe.dhcp;  #域名,一般写入被dhcp分配IP的服务器hosts文件中
  option domain-name "pxe.dhcp";    #域
  option routers 192.168.116.1;
  option domain-name-servers 8.8.8.8;
  option broadcast-address 192.168.116.255;
  default-lease-time 600;  #默认租期
  max-lease-time 7200;       #最大租期,无默认租期时使用
  next-server 192.168.116.90;  #tftp服务器
  filename "pxe/pxelinux.0";   #pxe文件目录
}

3. 配置httpd

[root@centos9 ~]# mkdir /var/www/html/{centos9,ks}
[root@centos9 ~]# mount /dev/sr0 /var/www/html/centos9
mount: /var/www/html/centos9: WARNING: source write-protected, mounted read-only.
[root@centos9 ~]# cat /var/www/html/ks/c9_ks.cfg 
#version=RHEL
# Use graphical/text install  #图形化/字符安装界面
#text
graphical

#使用系统上的第一个光驱执行安装
#cdrom
#装机使用的yum源
#repo --name="AppStream" --baseurl=file:///run/install/sources/mount-0000-cdrom/AppStream

#要实际运行安装,必须指定 cdrom、harddrive、hmc、nfs、liveimg 或 url 之一
url --url=http://192.168.116.90/centos9

#最小化安装,及其他预装应用
%packages
@^minimal-environment
kexec-tools
bash-completion

%end

#使用美式键盘
keyboard --xlayouts='us'
#系统默认语言设置,即环境变量$LANG,--addsupport添加对附加语言的支持
lang en_US.UTF-8 --addsupport=zh_CN

#设置主机名
network  --hostname=santiagod.ks
#IP设置,需指明device,否则会取消后续所有network指令
#network --bootproto=static --ip=192.168.122.10 --netmask=255.255.255.0 --gateway=192.168.122.1 --nameserver=8.8.8.8,114.114.114.114 --device=ens192


#enable时,系统第一次引导时启动 Initial Setup,设置语言、鼠标、键盘、root 密码、安全级别、时区以及默认网络配置。默认为disable
firstboot --disable

#使用这个选项在没有用户互动的情况下接受最终用户许可证协议(End User License Agreement,EULA)。指定这个选项可防止 Initial Setup 在完成安装并第一次重启系统后提示您接受该许可证
eula --agreed

#系统时区上海,使用UTC时间,不开启时间同步
timezone Asia/Shanghai --isUtc --nontp

# Root password: Admin123!
rootpw --iscrypted $6$uMfDCfQnqrZgk/yL$F.DkU0TF2k14QNqLUv.cc8X16ZUXGe/8Q./rspkY1tKnmOywrgcBx.eEA7u9oWT/u2T6jzNM410EL1Uy5oPk9/

#禁用selinux与firewalld
firewall --disabled
selinux  --disabled

#安装完成后,重启系统
#--eject - 在重新启动前尝试弹出可引导介质(DVD、USB 或其他介质)
reboot --eject

%include /tmp/part-include

#禁用kdump
%addon com_redhat_kdump --disable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end


#------------------------------------------------------------------------------------------------------------------------------------------------------
%pre

###设置系统盘
#找到大于10G的盘
disk=$(while read line;do awk 'BEGIN{} {if ($3 >= "10485760" && $2 == "0") print $4} END{}';done < /proc/partitions|grep -Ew 'sda|vda|hda')
#disk=sda,vda,hda

cat > /tmp/part-include << EOF_PART
#ignoredisk --only-use=$disk
clearpart --drives=$disk --all --initlabel

#基于 UEFI 的 AMD64、Intel 64 和 64 位 ARM 需要 200 MiB EFI 系统分区。推荐的最小值是 200 MiB,默认大小为 600 MiB,最大为 600 MiB。BIOS 系统不需要 EFI 系统分区
part /boot/efi --fstype="efi" --ondisk=$disk --size=600 --fsoptions="umask=0077,shortname=winnt"
#将sda创建为ID:311的物理卷,最小10G,若磁盘大于10G,也全部做成物理卷
#--grow 自增长
part pv.311 --fstype="lvmpv" --ondisk=$disk --size=10240 --grow
#boot分区,建议大小1G
part /boot --fstype="xfs" --ondisk=$disk --size=1024
#将pv.311加入卷组,默认pe大小4M
volgroup santiagod --pesize=4096 pv.311
#逻辑卷-交换空间,视磁盘大小而定,为安装时的系统盘大小10%
logvol swap --fstype="swap" --recommended --name=swap --vgname=santiagod
#逻辑卷-根分区,虽然 5 GiB 根文件系统允许您最小安装,但建议至少分配 10 GiB,以便可以尽可能安装您想要的软件包组
logvol / --fstype="xfs" --size=10240 --grow --name=root --vgname=santiagod

EOF_PART
#-------------------------------------------------------------------------------------------------------------

%end

4. 配置tftp+pxe

[root@centos9 ~]# mkdir -p /var/lib/tftpboot/pxe/pxelinux.cfg/
[root@centos9 ~]# ls /usr/share/syslinux/
altmbr.bin    cpuid.c32      elf.c32       ifcpu64.c32     isolinux.bin        libutil.c32  meminfo.c32   reboot.c32      vesainfo.c32
altmbr_c.bin  cpuidtest.c32  ethersel.c32  ifcpu.c32       isolinux-debug.bin  linux.c32    menu.c32      rosh.c32        vesamenu.c32
altmbr_f.bin  debug.c32      gfxboot.c32   ifmemdsk.c32    kbdmap.c32          lpxelinux.0  pci.c32       sanboot.c32     vpdtest.c32
cat.c32       dhcp.c32       gptmbr.bin    ifplop.c32      kontron_wdt.c32     ls.c32       pcitest.c32   sdi.c32         whichsys.c32
chain.c32     diag           gptmbr_c.bin  isohdpfx.bin    ldlinux.c32         lua.c32      pmload.c32    sysdump.c32     zzjson.c32
cmd.c32       dir.c32        gptmbr_f.bin  isohdpfx_c.bin  lfs.c32             mboot.c32    poweroff.c32  syslinux64.exe
cmenu.c32     disk.c32       gpxecmd.c32   isohdpfx_f.bin  libcom32.c32        mbr.bin      prdhcp.c32    syslinux.c32
config.c32    dmi.c32        hdt.c32       isohdppx.bin    libgpl.c32          mbr_c.bin    pwd.c32       syslinux.com
cptime.c32    dmitest.c32    hexdump.c32   isohdppx_c.bin  liblua.c32          mbr_f.bin    pxechn.c32    syslinux.exe
cpu.c32       dosutil        host.c32      isohdppx_f.bin  libmenu.c32         memdisk      pxelinux.0    vesa.c32
[root@centos9 ~]# cp /usr/share/syslinux/{pxelinux.0,ldlinux.c32,libcom32.c32,vesamenu.c32,libutil.c32} /var/lib/tftpboot/pxe/
[root@centos9 ~]# cat /var/lib/tftpboot/pxe/pxelinux.cfg/default 

timeout 60
default vesamenu.c32
timeout 60

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 CentOS Linux
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 Install linux 9 [auto]
  menu label ^Install centos Linux 9 [auto]
  kernel centos9/vmlinuz
  append initrd=centos9/initrd.img  inst.ks=http://192.168.116.90/ks/c9_ks.cfg inst.stage2=http://192.168.116.90/centos9 quit


label Install linux 9 [manual]
  menu label ^Install centos Linux 9 [manual]
  kernel centos9/vmlinuz
  append initrd=centos9/initrd.img  inst.stage2=http://192.168.116.90/centos9 quit

 

5. 启服务

systemctl restart tftp dhcpd httpd

 

标签:bin,none,kickstart,--,menu,pxe,centos9,c32
From: https://www.cnblogs.com/santia-god/p/17005329.html

相关文章

  • kickstart+pxe 多系统引导服务器搭建
    1.装包注:centos8下载dhcp-server,centos7下载dhcpyum-yinstalltftp-serverhttpdsyslinux-nonlinuxdhcp*2.配置dhcp服务注:需要使用dhcp服务对接pxe客户机注:{}......
  • pxe+kickstart多系统引导
    1.装包yum-yinstalldhcp*tftp-servervsftpdsyslinux-nonlinux2.配置dhcpcat>/etc/dhcp/dhcpd.conf<<EOF_DHCP#DHCPServerConfigurationfile.#see......
  • PXE(grub efi)部署Ubuntu18.04问题总结
    PXE(grubefi)部署Ubuntu18.04问题总结:1、HP默认只配置了第1个网卡和第1个光纤PXE启动解决:可在BIOS手动开启2、UbuntuISO要使用非live版(官网默认为live版,live多了试用......
  • 基于Ubuntu18.04 tftp+apache2+grub+nfs搭建PXE系统(EFI模式,手动安装)
    基于Ubuntu18.04tftp+apache2+grub+nfs搭建PXE系统(EFI模式,手动安装)注:用于支持个性系统安装需求apt-getinstalltftpd-hpaapt-getinstallapache2apt-getinstallnfs......
  • kickstart+mkisofs制作自动安装的镜像
    ks文件模板可以参考/root/anaconda_ks.cfg(根据当前操作系统实际安装情况生成的一个文件),然后以此为模板经行编辑,制作自己的ks文件。 ks.cfg文件组成大致分为3段1.......
  • pxe安装kylinos,almalinux,centos7,centos8
    一、PXE无盘简介预启动执行环境(PrebooteXecution Environment,PXE)也被称为预执行环境,提供了一种使用网络接口(NetworkInterface)启动计算机的机制。这种机制让计算机的启......
  • iPXE在Ubuntu20.04上的部署
    特别鸣谢:陆旭xu.lu老师找一个双网卡(有线+无线)的笔记本安装好Ubuntu20.04,WiFi网络作为互联网连接,物理网络接口作为DHCP和操作系统推送的连接接口,设置IP地址为10.1.1.99/24。#......
  • CentOS9新建swap分区
    ddif=/dev/zeroof=/home/swapbs=4096count=4096000/sbin/mkswap/home/swap/sbin/swapon/home/swapvi/etc/fstab末尾添加“/home/swapswapswapdefault00......
  • PXE批量装windows(半自动版本)
       一、 环境说明:客户端:CPU:双核内存:4GB内存80GB  ip地址:DHCP 服务端1:CPU:双核内存:1GB内存20GB  ip地址:192.168.40.254    设备标识:Centos7X64......
  • ipxe
      IPXE初识及其简单应用   ipxe有什么用,干什么的   概述:PXE(prebootexecute......