Linux —— pxe企业自动部署环境

1. 部署vsftpd

共享ks文件 
共享安装源

 

2. 搭建dhcpd服务器

分配ip等信息到客户端

3. 部署pxe环境

dnf install syslinux-nonlinux-6.04-1.el8.noarch -y ##获得pxelinux.0文件 
dnf install tftp-server.x86_64 ##pxelinux.0共享服务器 
systemctl start tftp 
cp /usr/share/syslinux/pxelinux.0  /var/lib/tftpboot/ ##共享pxelinux.0 
cp /var/ftp/rhel8/isolinux/*   /var/lib/tftpboot/ ##共享安装环境所要读取的文件 
mkdir /var/lib/tftpboot/pxelinux.cfg/ 
cp /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default ##生成 pxelinux.0默认读取文件

 

 

4. dhcpd服务配置分发pxelinux.0

30 subnet 192.168.0.0 netmask 255.255.255.0 { 
31   range 192.168.0.44 192.168.0.50; 
32   option routers 192.168.0.1; 
33   next-server 192.168.0.11; ##tftp服务器地址 
34   filename "pxelinux.0"; ##需要读取的文件名称 
35 }    

 

 

5. 设定pxelinux.cfg/default

修改对应的设定信息,并查看效果:

default vesamenu.c32 timeout 50 ##安装界面等待时间
 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 WESTOS INSTALL OS pxe from OLDLEE ##安装标题 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
File: /root/pxe网络安装服务器的部署 Page 2 of 3
 
# 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 linux  menu label ^Install Red Hat Enterprise Linux 8.0.0  menu default ##设定默认选择标题  kernel vmlinuz  append initrd=initrd.img repo=ftp://192.168.0.11/rhel8  ks=ftp://192.168.0.11/ ksfile/ks.cfg ##指定安装源和ks文件
 label check  menu label Test this ^media & install Red Hat Enterprise Linux 8.0.0 #  menu default  kernel vmlinuz  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-8-0-0-BaseOS-x86_64 rd.live.check quiet
 menu separator # insert an empty line
 # utilities submenu menu begin ^Troubleshooting  menu title Troubleshooting
 label vesa  menu indent count 5  menu label Install Red Hat Enterprise Linux 8.0.0 in ^basic graphics mode  text help Try this option out if you're having trouble installing Red Hat Enterprise Linux 8.0.0.  endtext  kernel vmlinuz  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-8-0-0-BaseOS-x86_64 nomodeset 
File: /root/pxe网络安装服务器的部署 Page 3 of 3
quiet
 label rescue  menu indent count 5  menu label ^Rescue a Red Hat Enterprise Linux system  text help If the system will not boot, this lets you access files and edit config files to try to get it booting again.  endtext  kernel vmlinuz  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-8-0-0-BaseOS-x86_64 rescue quiet
 label memtest  menu label Run a ^memory test  text help If your system is having issues, a problem with your system's memory may be the cause. Use this utility to see if the memory is working correctly.  endtext  kernel memtest
 menu separator # insert an empty line
 label local  menu label Boot from ^local drive  localboot 0xffff
 menu separator # insert an empty line menu separator # insert an empty line
 label returntomain  menu label Return to ^main menu  menu exit
 menu end

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Linux部署PXE(Preboot Execution Environment),您需要执行以下步骤: 1. 安装和配置DHCP服务器:您需要安装并配置一个DHCP服务器,以便为客户端提供IP地址和PXE引导文件的位置。在大多数Linux发行版中,您可以使用`dhcpd`软件包来实现这一点。编辑DHCP服务器的配置文件(通常位于`/etc/dhcp/dhcpd.conf`),并为客户端指定PXE引导文件的位置。 2. 安装和配置TFTP服务器:TFTP(Trivial File Transfer Protocol)用于传输PXE引导文件到客户端。您可以使用`tftpd-hpa`软件包来安装TFTP服务器。编辑TFTP服务器的配置文件(通常位于`/etc/default/tftpd-hpa`),确保指定PXE引导文件的目录。 3. 准备PXE引导文件:PXE引导文件是客户端在启动时下载和执行的文件。您可以从网络上下载一个通用的PXE引导文件,例如`pxelinux.0`。将该文件复制到TFTP服务器配置文件中指定的目录。 4. 配置网络引导:在DHCP服务器配置文件中,指定客户端将从哪个服务器下载PXE引导文件。您需要在DHCP配置文件中添加类似以下内容的条目: ``` next-server <TFTP服务器IP地址>; filename "pxelinux.0"; ``` 将`<TFTP服务器IP地址>`替换为您TFTP服务器的实际IP地址。 5. 启动和测试:启动DHCP和TFTP服务器,并确保客户端能够通过PXE引导。您可以在客户机上启用PXE引导选项,并检查其是否能够成功下载并执行PXE引导文件。 请注意,这只是一个大致的概述,具体步骤可能因Linux发行版和软件包版本而有所不同。确保参考相关文档和指南以获得更详细的说明。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值