当前位置:网站首页>pxe装机「建议收藏」
pxe装机「建议收藏」
2022-07-02 18:38:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
安装环境:
一台已安装Linux系统的主机作为PXE Server, 本文中PXE Server使用的系统是CentOS 7;
若干台待安装CentOS7的裸主机作为PXE Client;
PXE Server与所有PXEClient处于同一局域网中;
所有主机支持PXE启动安装方式。
PXEServer安装及配置流程:
\1. 配置 DHCP 服务
\2. 配置 TFTP 服务
\3. 配置http做文件仓库和修改ks.cfg文件
\4. 相关系统引导文件存储
\5. 配置default系统启动文件
\6. 检查PXEServer的状态并启动PXE Client
PXEServer安装及配置具体步骤:
1. 配置DHCP服务
安装DHCP
# yum install -y dhcp
当前PXE Server的IP地址为192.168.0.125,DHCP、TFTP与http均部署在该台主机上,配置dhcp配置文件**/etc/dhcp/dhcpd.conf**如下
############################
ddns-update-style interim; ignore client-updates; allow booting; allow bootp;
class “pxeclients”{ match if substring(option vendor-class-identifier,0,9)=“PXEClient”; filename “pxelinux.0”; next-server 192.168.0.125; }
subnet 192.168.0.0 netmask 255.255.255.0{ default-lease-time 216000; max-lease-time 432000; option time-offset -18000; range dynamic-bootp 192.168.0.210 192.168.0.240; option subnet-mask 255.255.255.0; option routers 192.168.0.1; }
############################
启动并且配置开机启动dhcpd服务
# systemctl start dhcpd
# systemctl enable dhcpd
2. 配置TFTP服务
安装tftp的server和client包
# yum install -y tftp*
安装xinetd守护进程,因为tftp依赖于xinetd
# yum install -y xinetd
修改tftp配置文件/etc/xinetd.d/tftp,将disable= yes改为disable=no
关闭并配置开机自动关闭系统防火墙(重要!否则会导致PXE Client无法访问TFPT服务)
# systemctl stop firewalld
# systemctl disable firewalld
启动并配置开机自动启动xinetd进程
# systemctl start xinetd
# systemctl enable xinetd
# systemctl start tftp
3. 配置http做文件仓库和修改ks.cfg文件
安装httpd服务
# yum install –y httpd
启动并且配置开机启动httpd服务
# systemctl start httpd
# systemctl enable httpd
放入待安装系统盘,并直接用光盘的package当做安装仓库
# mkdir /var/www/html/centos7
# mount /dev/cdrom /var/www/html/centos7/
将当前系统中的ks文件拷贝到/var/www/html/路径下
# cp /root/anaconda-ks.cfg /var/www/html/ks.cfg
修改ks.cfg配置文件/var/www/html/ks.cfg
ks.cfg的作用是预先指定好需要的安装选项(包括系统镜像路径,安装组件,系统语言,网络配置,用户及密码等),
当正式安装时PXE Client将会很据该文件去自动配置安装,从而避免了大规模部署时的大量重复操作。
主要修改的地方是将
# Use CDROM installation media
cdrom
修改为
# Use network installation
url –url=”http://192.168.0.125/centos7″
从而指定PXE Client从哪里去获得镜像文件,ks.cfg文件修改后如下:
#version=DEVEL
# System authorization information
auth –enableshadow –passalgo=sha512
# Use network installation
url –url=“http://192.168.0.125/centos7”
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot –enable
# Keyboard layouts
keyboard –vckeymap=cn –xlayouts=‘cn’
# System language
lang zh_CN.UTF-8
# Network information
network –bootproto=dhcp–device=eno16777736 –ipv6=auto –activate
network –hostname=localhost.localdomain
# Root password
rootpw –iscrypted 6 6 6qUeqvWWOr921mWBY$h5wjwdcnIOC/FS6rCaZblKNGELwN9jrGwJZuwlrNi9OHzI.n1lxaKKrkwdN7nadXP5f2mFRDrW9D9gYStXGZu/
# System timezone
timezone Asia/Shanghai –isUtc
user –groups=wheel –name=pxetest–password= 6 6 6.hgpJdCAhSMaf7yB$5GKYIAgTkLxfS1JHK5KSpN96LXhkKGFX3FbnQl0hTME3wbF1njxyezmPF/HXAtI9Bp8U6MsF3hRXlFvFfn9Nm/–iscrypted –gecos=“pxetest”
# System bootloader configuration
bootloader –append=” crashkernel=auto”–location=mbr –boot-drive=sda
autopart –type=lvm
# Partition clearing information
clearpart –none –initlabel
%packages
@^infrastructure-server-environment
@base
@compat-libraries
@core
@debugging
@development
@dns-server
@file-server
@ftp-server
@security-tools
@smart-card
kexec-tools
%end
%addon com_redhat_kdump –enable–reserve-mb=‘auto’
%end
4. 相关系统引导文件存储
安装syslinux,它是一个功能强大的引导加载程序,而且兼容各种介质。
# yum install -y syslinux
pxelinux.0文件名要和dhcp配置文件内的一致
# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
copy光盘目录中的vmlinuz和initrd.img,这两个文件相当于系统启动时/boot目录下的启动文件,这个用来引导anacoda而不是根
# cp /mnt/cdrom/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/
copy pxe引导所需要的配置文件,splash.png:背景图.boot.msg启动标语,vesamenu.c32:显示同行界面用的程序.
# cp /mnt/cdrom/isolinux/{boot.msg,vesamenu.c32,splash.png} /var/lib/tftpboot/
pxe启动时显示配置文件信息,和光盘启动类似.
# mkdir /var/lib/tftpboot/pxelinux.cfg
# cp /mnt/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
5. 配置default系统启动文件
在default配置文件/var/lib/tftpboot/pxelinux.cfg/default中找到下面标签
label linux
menu label^Install CentOS 7
kernel vmlinuz
menu default
append initrd=initrd.img inst.stage2=http://192.168.0.125/centos7 inst.ks=http://192.168.0.125/ks.cfg quiet
注意标红的地方,它的目的是用于告诉PXEClient去哪里可以找到镜像文件以及ks.cfg配置文件。
6. 检查PXE Server的状态并启动PXE Client
# service dhcpd status
# service tftp status
# service httpd status
以上三者结果都应该为active(running)
# service firewalld status
结果都应该为inactive(dead)
检查待安装系统盘是否以及挂载到指定目录下(/var/www/html/centos7/)
如果以上状态均正常,可以开始启动PXEClient,并将启动方式设置为网卡启动。
常见问题:
1、 PXE Server每次启动后IP地址都不相同?
答:应该讲PXE Server设置为静态IP,否则每次重启都需要根据新IP修改配置文件
2、 PXE Server重启后Client端显示连接不到TFTP服务器?
答:PXE Server每次重启后需要重新打开tftp服务
#service tftp start
3、 PXE Server重启后Client端显示无法访问到指定文件?
答:PXE Server每次重启后需要重新mount光盘到指定路径
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/148567.html原文链接:https://javaforall.cn
边栏推荐
- LeetCode 0871. Minimum refueling times - similar to poj2431 jungle adventure
- Registration opportunity of autowiredannotationbeanpostprocessor in XML development mode
- Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
- Golang concurrent programming goroutine, channel, sync
- 电脑使用哪个录制视频软件比较好
- Memory management of C
- PHP-Parser羽毛球预约小程序开发require线上系统
- 云呐|为什么要用固定资产管理系统,怎么启用固定资产管理系统
- 2022.7.1-----leetcode.241
- [error record] problems related to the installation of the shuttle environment (follow-up error handling after executing the shuttle doctor command)
猜你喜欢

Use cheat engine to modify money, life and stars in Kingdom rush

Py之interpret:interpret的简介、安装、案例应用之详细攻略

AcWing 1126. 最小花费 题解(最短路—dijkstra)

PHP parser badminton reservation applet development requires online system

Yunna | why use the fixed asset management system and how to enable it

Refactoring: improving the design of existing code (Part 1)

xml开发方式下AutowiredAnnotationBeanPostProcessor的注册时机

Chic Lang: completely solve the problem of markdown pictures - no need to upload pictures - no need to network - there is no lack of pictures forwarded to others

Yolov3 trains its own data set to generate train txt

Tutorial (5.0) 10 Troubleshooting * fortiedr * Fortinet network security expert NSE 5
随机推荐
MySQL
多态的理解以及作用
函数高阶-柯里化实现
golang:[]byte转string
Data dimensionality reduction factor analysis
《代码整洁之道》读书笔记
AcWing 343. 排序 题解(floyd性质实现传递闭包)
Binary operation
Compile oglpg-9th-edition source code with clion
AcWing 1126. 最小花费 题解(最短路—dijkstra)
Typescript 之 快速入门
安装单机redis详细教程
Gamefi chain game system development (NFT chain game development function) NFT chain game system development (gamefi chain game development source code)
Qpropertyanimation use and toast case list in QT
Reading notes of "the way to clean structure" (Part 2)
Juypter notebook modify the default open folder and default browser
数据湖(十二):Spark3.1.2与Iceberg0.12.1整合
2022 software engineering final exam recall Edition
Pytorch版本、CUDA版本与显卡驱动版本的对应关系
xml开发方式下AutowiredAnnotationBeanPostProcessor的注册时机