共享`pexlinux`数据文件的网络服务

news/2024/10/22 12:31:55/

实验环境准备:

1.红帽7主机

2.要全图形安装

3.配置网络为手动,配置网络可用

4.关闭vmware DHCP功能

一、kickstart自动安装脚本制作

1.安装图形化生成kickstart自动脚本安装工具

2.启动图形制作工具

3.图形配置脚本

这里使用的共享方式是http,这里不能乱写,需要根据自己的主机IP和自己创建的共享目录来填写,需要自己提前配置好http服务,具体步骤如下:

#下载hhtpd软件包,这里我已经下载了
[root@localhost redhat]# yum install httpd -y
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-: managerThis system is not registered with an entitlement server. You can use subscription-manager to register.baseos                                                 | 2.8 kB     00:00     
Package httpd-2.4.6-95.el7.x86_64 already installed and latest version
Nothing to do#/rhel7目录是我自己创建的目录用于写仓库和挂载,根据自己所创建的目录来更改
[root@localhost redhat]# ls /rhel7/
addons            images      repodata
EFI               isolinux    RPM-GPG-KEY-redhat-beta
EULA              LiveOS      RPM-GPG-KEY-redhat-release
extra_files.json  media.repo  TRANS.TBL
GPL               Packages#将创建rhel7目录的软连接指向http服务的默认目录/var/www/html/中,创建软连接使用ln -s命令
[root@localhost redhat]# ll /var/www/html/
total 4
-rw-r--r--. 1 root root 1205 Aug  4 04:19 ks.cfg
lrwxrwxrwx. 1 root root    7 Aug  3 22:54 rhel7 -> /rhel7/

创建分区: 

 

 这里根据自己网卡名选择Add添加

 

 

 这里的内容是系统在启动后去执行的脚本,这里可以根据自己的需要去写就好了,需要启动后执行什么就在上面写上对应的命令

4.保持配置,保存路径自选,这里是/root

5.打开上面保存的ks脚本,配置安装时要下载的软件包

 删除--maxsize=1

 

6.新建一台红帽7虚拟机,测试自动安装,具体操作如下:

 

正常情况这里安装是会有问题的,不能够安装成功,还需要下面的操作,搭建DHCP服务。

二、搭建dhcp服务并测试kickstart脚本

在上一个实验的基础上继续。

1.安装dhcp服务器为其他服务器提供分配IP的功能

2.生成配置文件 

3.编写配置文件  

打叉表示35行下面的都不要

 整个配置文件内容如下:

[root@localhost ~]# cat /etc/dhcp/dhcpd.conf 
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
## option definitions common to all supported networks...
option domain-name "timingma.org";
option domain-name-servers 114.114.114.114;default-lease-time 600;
max-lease-time 7200;# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;# No service will be given on this subnet, but declaring it helps the 
# DHCP server to understand the network topology.#subnet 10.152.187.0 netmask 255.255.255.0 {
#}# This is a very basic subnet declaration.subnet 172.25.254.0 netmask 255.255.255.0 {range 172.25.254.30 172.25.254.40;option routers 172.25.254.2;
}

修改的地方如下:

 4.配置文件编写好后,启动DHCP服务

[root@localhost ~]# systemctl enable --now dhcpd

5.新建红帽7虚拟机,测试自动安装

 这里安装就可以了,正常情况就可以自动安装了。

 三、共享pexlinux数据文件的网络服务

在上一个实验的基础上继续。

1.下载软件包

  

2.启动服务
[root@localhost ~]# systemctl enable --now tftp
3.复制文件到pexlinux的默认共享目录/var/lib/tftpboot/

这里我磁盘挂载的地方是在/rhel7目录下,根据自己的具体情况来定

红帽在启动时的页面的定义是在isolinux目录下的文件定义的,所以需要将这些文件共享出去

[root@localhost ~]# df
Filesystem            1K-blocks    Used Available Use% Mounted on
devtmpfs                 914480       0    914480   0% /dev
tmpfs                    931516       0    931516   0% /dev/shm
tmpfs                    931516   10712    920804   2% /run
tmpfs                    931516       0    931516   0% /sys/fs/cgroup
/dev/mapper/rhel-root  17811456 4297536  13513920  25% /
/dev/sda1               1038336  187276    851060  19% /boot
tmpfs                    186304      36    186268   1% /run/user/1000
/dev/sr0                4420474 4420474         0 100% /rhel7
tmpfs                    186304       0    186304   0% /run/user/0
[root@localhost ~]# cp /rhel7/isolinux/* /var/lib/tftpboot/
[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
4.移动到默认目录,创建default目录

5.修改/etc/dhcp/dhcpd.conf配置文件
# This is a very basic subnet declaration.subnet 172.25.254.0 netmask 255.255.255.0 {range 172.25.254.30 172.25.254.40;option routers 172.25.254.2;next-server 172.25.254.131;   #这里指定下一个服务器找谁filename "pxelinux.0";   #这个表示找哪个文件
}
6.修改default文件

前提你的共享地址在浏览器上是可以访问到的如下:

如果访问显示的错误码是404,那可能是你的文件路径有问题,没有找到,要根据自己创建的目录来定;如果是没有权限,那检查一下自己的防火墙有没有关等。

 

[root@localhost ~]# cat /var/lib/tftpboot/pxelinux.cfg/default 
default vesamenu.c32
timeout 30  #这里是在安装系统的选择页面的等待时间,30为3秒,默认是600,这里我们将其改为三秒让其指定安装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 Red Hat Enterprise Linux 7.9
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 linuxmenu label ^Install Red Hat Enterprise Linux 7.9 hahahahahahaha  #为了检验,我们在这里自定义一下,随便写,我这里加了hahahhahahkernel vmlinuzmenu default   #这里表示在在安装页面时的默认选项,我们将其改到开始安装这个选项这里append initrd=initrd.img repo=http://172.25.254.131/rhel7 ks=http://172.25.254.131/ks.cfg quiet     #这里的文件不能乱写了,IP地址为共享文件的主机,为了确保路径可以使用,可以自己提前在浏览器上访问一下,确保自己可以访问到label checkmenu label Test this ^media & install Red Hat Enterprise Linux 7.9kernel vmlinuz#menu default   #将默认的删除或者注释掉append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.9\x20Server.x86_64 rd.live.check quietmenu separator # insert an empty line# utilities submenu
menu begin ^Troubleshootingmenu title Troubleshootinglabel vesamenu indent count 5menu label Install Red Hat Enterprise Linux 7.9 in ^basic graphics modetext helpTry this option out if you're having trouble installingRed Hat Enterprise Linux 7.9.endtextkernel vmlinuzappend initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.9\x20Server.x86_64 xdriver=vesa nomodeset quietlabel rescuemenu indent count 5menu label ^Rescue a Red Hat Enterprise Linux systemtext helpIf the system will not boot, this lets you access filesand edit config files to try to get it booting again.endtextkernel vmlinuzappend initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.9\x20Server.x86_64 rescue quietlabel memtestmenu label Run a ^memory testtext helpIf your system is having issues, a problem with yoursystem's memory may be the cause. Use this utility tosee if the memory is working correctly.endtextkernel memtestmenu separator # insert an empty linelabel localmenu label Boot from ^local drivelocalboot 0xffffmenu separator # insert an empty line
menu separator # insert an empty linelabel returntomainmenu label Return to ^main menumenu exitmenu end
7.测试

在新建的红帽7虚拟机启动时,选择打开电源时进入固件

选择如下: 

boot选择Network boot from Intel E1000 ,通过网络引导启动的方式;'+'号向上移动,‘-’号向下移动

 

回车后选择yes 

可以看见安装页面就是我们定义的页面了,默认选择第一个,等待三秒

 3秒之后就会自动安装,只需等待就可以了

安装完成后记得关机再选择打开电源时进入固件,将启动方式更改成默认的方式:Hard Drive 即硬盘启动方式。不然会进入无限快乐模式,一直安装不停。


http://www.ppmy.cn/news/1505062.html

相关文章

酒店管理小程序的设计

管理员账户功能包括:系统首页,个人中心,用户管理,酒店管理员管理,房间类型管理,房间信息管理,订单信息管理,系统管理 微信端账号功能包括:系统首页,房间信息…

微应用(Micro-Applications)、微前端(Micro Frontend)、Qiankun 框架之间的区别和联系

简简单单 Online zuozuo: 简简单单 Online zuozuo 简简单单 Online zuozuo 简简单单 Online zuozuo 简简单单 Online zuozuo :本心、输入输出、结果 简简单单 Online zuozuo :联系我们:VX :tja6288 / EMAIL: 347969164@qq.com 文章目录 微应用(Micro-Applications)、微…

Go语言加Vue3零基础入门全栈班11 Go语言+gorm用户管理系统实战 2024年08月03日 课程笔记

概述 如果您没有Golang的基础,应该学习如下前置课程。 Golang零基础入门Golang面向对象编程Go Web 基础Go语言开发REST API接口_20240728Go语言操作MySQL开发用户管理系统API教程_20240729Redis零基础快速入门_20231227GoRedis开发用户管理系统API实战_20240730Mo…

JS如何实现禁止截屏、打印、另存为操作?

禁止缓存可以前台HTML使用 <meta http-equiv="pragma" content="no-cache" /> 屏蔽选中、粘贴、复制、剪切、右键菜单、禁止新窗口打开 HTML <body οncοntextmenu="return false" onselectstart="return false" οncοn…

搭建 Rancher 服务,配置k8s集群

1. 前提条件 前提条件&#xff1a; 安装docker&#xff0c;要求版本各节点版本一致。网上还有额外的要求&#xff1a;关闭swap、禁用selinux等等。 2. 搭建 Rancher 服务 直接通过docker命令实现即可&#xff0c;很方便。 docker run -d \--name rancher \--restart unles…

go的并发任务如何优雅的实现错误终止

errgroup使用案例 在Go语言中&#xff0c;并发任务通常通过goroutine来实现&#xff0c;而错误处理和任务终止的优雅性则依赖于适当的同步机制和错误传播策略。 场景: 管理一个任务的一组子任务&#xff0c;每个子任务一个协程每个子任务必须保证都成功&#xff0c;一个出现…

注意!!可能这是系统分析师旧教程最后一次考试,赶紧学起来

系统分析师考试是全国计算机技术与软件专业技术资格考试的高级水平考试之一&#xff0c;它是一项专业考试&#xff0c;旨在通过对计算机系统的规划、分析和设计来培养行业内的专业技术人才。近日在国家版本数据中心&#xff0c;查到系统分析师已经有2024最新版的教程出来了&…

EasyAR_稀疏空间图

EasyAR_稀疏空间图 EasyAR4.6.3 丨 Unity2020.3.15f2 1.创建稀疏空间地图 在EasyAR开发中心后台创建Scene许可证密钥&#xff0c;并且使用稀疏空间地图 2.设置稀疏空间地图库名&#xff0c;对稀疏空间地图进行管理&#xff0c;设置密钥 3.复制密钥到Unity中 添加Spatial Map Ap…