当前位置: 首页 > news >正文

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

实验环境准备:

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.lryc.cn/news/414784.html

相关文章:

  • HC32F4A0 10路串口UART 配置
  • 拯救PyCharm:击退IDE崩溃的终极策略
  • 深入解析Unix命令:掌握wc、whereis和which的使用技巧
  • 奥运会大规模使用中国AI大模型!
  • Linux中的线程3
  • 内网权限维持——利用WMI进行权限维持
  • 【数据结构算法经典题目刨析(c语言)】括号匹配问题(图文详解)
  • 浅谈 Spring AOP框架 (1)
  • Linux 面试准备 - 2024
  • C++笔记---类和对象(中)
  • 【C++】入门基础知识
  • AI的应用场景和未来展望
  • vim、sublime、notepad文本编辑器的使用
  • PyCharm中的外部更改识别:终极解决方案指南
  • Qt——QTCreater ui界面如何统一设置字体
  • Linux驱动入门实验班day03-GPIO子系统概述
  • 240803-沉侵式翻译插件配置Ollama的API实现网页及PDF文档的翻译
  • HTML-08.表单标签
  • SAP ABAP se16n 双击跳转实现
  • Linux shell编程学习笔记68: curl 命令行网络数据传输工具 选项数量雷人(上)
  • 马尔科夫决策过程
  • 未知攻焉知防:从攻击者视角看网络安全的“攻守之道”
  • 数字孪生赋能智慧城市大脑智建设方案(可编辑65页PPT)
  • c++----内存管理
  • C++——哈希结构
  • 智能小程序 Ray 开发面板 SDK —— 无线开关一键执行模板教程(一)
  • rockDB(1)
  • [element-ui] 自动获取el-input的焦点
  • 智能闹钟的睡眠评估算法是如何工作的呢
  • Vue + View-ui-plus Upload实现手动上传