RHEL8/Centos8 install for PXE

2024-06-09 10:12
文章标签 install centos8 pxe rhel8

本文主要是介绍RHEL8/Centos8 install for PXE,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

PXE介绍

PXE(Preboot Execution Environment)是预引导执行环境的缩写。它是由Intel设计的,允许客户端计算机通过网络从服务器上加载操作系统镜像。PXE通常用于大规模部署操作系统,例如在企业或学校环境中。

PXE工作流程如下:

  • 当计算机启动时,BIOS 会进行 POST(Power-On Self-Test)自检,检查硬件是否正常运行。
  • BIOS 随后会从默认启动设备(通常是硬盘)加载引导加载程序(Bootloader)。
  • Bootloader 会查找并加载 PXE 客户端软件(通常是 Intel 的 PXE Client)。
  • PXE Client 通过广播寻找并选择可用的 PXE 服务端(通常是服务器)。
  • 服务器通过 TFTP(Trivial File Transfer Protocol)协议将操作系统镜像发送到客户端。
  • 客户端计算机接收并加载操作系统镜像,然后开始安装操作系统。

因此,通过 PXE,IT 管理员可以在大型网络中自动化和集中管理操作系统部署。

更改IP

  • 根据需求修改
sed -ri 's/192.168.10.10/172.18.13.99/g' autoinstall.sh
sed -ri 's/192.168.10./172.18.13./g' autoinstall.sh
  • 执行脚本
bash autoinstall.sh

脚本内容示例

#!/bin/bash#挂载光盘
mkdir /media/cdrom
echo "/dev/sr0 /media/cdrom iso9660 defaults 0 0" >> /etc/fstab
mount -a#配置本地YUM源
touch /etc/yum.repos.d/rhel8.repo
cat > /etc/yum.repos.d/rhel8.repo <<EOF
[BaseOS]
name=BaseOS
baseurl=file:///media/cdrom/BaseOS
enabled=1
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///media/cdrom/AppStream
enabled=1
gpgcheck=0
EOF
#同步YUM仓库
dnf makecache#清除规则并关闭防火墙
iptables -F
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
#关闭selinux
setenforce 0
sed -ri 's/=enforcing/=disabled/g' /etc/selinux/config
cat /etc/selinux/config
getenforce#安装配置dhcp
dnf install -y dhcp-servercat > /etc/dhcp/dhcpd.conf <<EOF
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp-server/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#
allow booting;
allow bootp;
ddns-update-style none;
ignore client-updates;
subnet 172.16.13.0 netmask 255.255.255.0 {option subnet-mask                      255.255.255.0;option domain-name-servers              172.16.13.99;range dynamic-bootp 172.16.13.110      172.16.13.200;default-lease-time                      21600;max-lease-time                          43200;next-server                             172.16.13.99;filename                                "pxelinux.0";
}
host yjy-test-01 {hardware ethernet 00:0c:29:df:6c:a0;fixed-address 172.16.13.199;
}
EOF
systemctl start dhcpd
systemctl enable dhcpd
systemctl status dhcpdsleep 5#安装配置tftp-server、xinetd
dnf install -y tftp-server xinetd
touch /etc/xinetd.d/tftp
cat > /etc/xinetd.d/tftp <<EOF
service tftp
{socket_type     = dgramprotocol        = udpwait            = yesuser            = rootserver          = /usr/sbin/in.tftpdserver_args     = -s /var/lib/tftpbootdisable         = noper_source      = 11cps             = 100 2flags           = IPv4
}
EOF
systemctl start xinetd
systemctl enable xinetd
systemctl status xinetdsleep 5#安装syslinux,COPY相关配置文件
dnf install -y syslinux
unalias cp
cp -f /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
cp -f /media/cdrom/images/pxeboot/* /var/lib/tftpboot/
cp -f /media/cdrom/isolinux/* /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg
cp /media/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
chmod 755 /var/lib/tftpboot/pxelinux.cfg/default
sed -ri 's@default vesamenu.c32@default linux@g' /var/lib/tftpboot/pxelinux.cfg/default
sed -ri 's@hd:LABEL=RHEL-8-0-0-BaseOS-x86_64 quiet@ftp://172.16.13.99 ks=ftp://172.16.13.99/pub/ks.cfg quiet@g' /var/lib/tftpboot/pxelinux.cfg/defaultsleep 5#安装配置vsftpd
dnf install -y vsftpd
sed -ri 's/anonymous_enable=NO/anonymous_enable=YES/g' /etc/vsftpd/vsftpd.conf
systemctl start vsftpd
systemctl enable vsftpd
systemctl status vsftpd#COPY数据到ftp目录并设置SELinux(虽然开始关了-_-)
cp -r /media/cdrom/* /var/ftp
setsebool -P ftpd_connect_all_unreserved=on#创建KickStart应答文件
touch /var/ftp/pub/ks.cfg
chmod 755 /var/ftp/pub/ks.cfg
cat > /var/ftp/pub/ks.cfg <<EOF
#version=RHEL8
ignoredisk --only-use=sda
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
graphical
#repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
repo --name="AppStream" --baseurl=ftp://172.16.13.99/AppStream
# Use CDROM installation media
#cdrom
url --url=ftp://172.16.13.99/BaseOS
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# selinux configuration
selinux --disabled#Reboot after installation
reboot# Network information
network  --bootproto=dhcp --device=ens160 --onboot=on --ipv6=auto --activate
network  --hostname=test
# Root password
rootpw 123456
# Run the Setup Agent on first boot
firstboot --enable
# Do not configure the X Window System
skipx
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# Disk partitioning information
part /boot --fstype="xfs" --ondisk=sda --size=1024
part pv.217 --fstype="lvmpv" --ondisk=sda --size=1 --grow
volgroup rhel --pesize=4096 pv.217
logvol / --fstype="xfs" --grow --size=1024 --name=root --vgname=rhel
logvol swap --fstype="swap" --size=2047 --name=swap --vgname=rhel%packages
@^server-product-environment
kexec-tools%end%addon com_redhat_kdump --enable --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
EOFsystemctl restart dhcpd
systemctl restart xinetd
systemctl restart vsftpd
systemctl status dhcpd
systemctl status xinetd
systemctl status vsftpd

分享、在看与点赞
只要你点,我们就是胖友

来自: RHEL8/Centos8 install for PXEicon-default.png?t=N7T8https://mp.weixin.qq.com/s?__biz=Mzk0NTQ3OTk3MQ==&mid=2247485775&idx=1&sn=99c2678ffc2dfef9552d84a9ebef6388&chksm=c3158103f462081511d082242469d3f7aa7e8d66e314f39cad457c2c9b2926300f1b0c71781d&token=355315523&lang=zh_CN#rd

这篇关于RHEL8/Centos8 install for PXE的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1044889

相关文章

pip install jupyterlab失败的原因问题及探索

《pipinstalljupyterlab失败的原因问题及探索》在学习Yolo模型时,尝试安装JupyterLab但遇到错误,错误提示缺少Rust和Cargo编译环境,因为pywinpty包需要它... 目录背景问题解决方案总结背景最近在学习Yolo模型,然后其中要下载jupyter(有点LSVmu像一个

收藏:解决 pip install 出现 error: subprocess-exited-with-error 错误的方法

在使用 pip 安装 Python 包时,有时候会遇到 error: subprocess-exited-with-error 错误。这种错误通常是由于 setuptools 版本问题引起的。本文将介绍如何解决这一问题 当你使用 pip install 安装某个 Python 包时,如果 setuptools 版本过高或过低,可能会导致安装过程出错,并出现类似以下错误信息:error: subpr

[轻笔记] pip install : Read timed out. (closed)

添加超时参数(单位秒) pip --default-timeout=10000 install ${package_name}

pip install pyaudio sounddevice error: externally-managed-environment

shgbitai@shgbitai-C9X299-PGF:~/pythonworkspace/ai-accompany$ pip install pyaudio sounddeviceerror: externally-managed-environment× This environment is externally managed╰─> To install Python package

maven 指令之package 和install的区别

https://blog.csdn.net/zy103118/article/details/79901357   maven 指令之package 和install的区别 2018年04月11日 19:08:46 brave_zhao 阅读数:2018更多 个人分类: maven maven package 和 install 区别 原创 2016年08月18日 14:55:26

安装Python(install python),安装pip(install pip)

海南副教授陈晶优下台 ,shut down        you are rubbish ,you need study. How to install python environment and pip?   Step 1:Download https://www.python.org/download

VMware17 虚拟机下载以及 CentOS8 操作系统安装配置 一条龙全教程

目录 一、安装 vmware workstation 虚拟机  二、安装 CentOS8 操作系统 三、安装 FinalShell 远程连接 一、安装 vmware workstation 虚拟机     安装中...(耐心等待)  到此安装完成,点击启动运行  激活码如下:  MC60H-DWHD5-H80U9-6V85M-8280D

【解决bug之路】npm install node-sass(^4.14.1)连环报错解决!!!(Windows)

有关node-sass的深入分析可参考:又报gyp ERR!为什么有那么多人被node-sass 坑过? 主要有如下三方面错误,请自查: 1.node,npm版本需与node-sass版本匹配,像node-sass(^4.14.1)就得node 14.x版本才可以,node 16不行 gyp ERR! build error15 gyp ERR! stack Error: `

[INSTALL] MSYS2 -- Windows下的类Linux环境

一、安装 1. 从https://www.msys2.org/ 下载安装msys2 也可以从镜像: http://mirrors.aliyun.com/msys2/distrib/x86_64/ 下载最新的安装包 msys2-x86_64-20230718.exe 2. 更新下载源为阿里云 sed -i "s#https\?://mirror.msys2.org/#http://mirrors

pod install 报错处理

由于墙的原因,pod install 、 pod update经常报错 有效的解决方案(推荐): 以SnapKit为例 找不报错的同事要以下两个文件(指定的版本) 1. /Users/xxx/Library/Caches/CocoaPods/Pods/Release/SnapKit 2. /Users/xxx/Library/Caches/CocoaPods/Pods/Specs