PXE自动化安装CentOS 8_centos8 pxe boot arp timeout-程序员宅基地

技术标签: PEX  linux  centos8 PXE自动化安装  linux PEX  

安装前准备:关闭防火墙和SELINUX,DHCP服务器静态IP。
切勿用桥接模式 最好是NET模式而且把自动分配DHCP对勾取消。

在这里插入图片描述
查看防火墙和seelinux是否关闭

[root@centos8 ~]#firewall-cmd --state
not running
[root@centos8 ~]#getenforce 
Disabled

安装对应的软件包

在这里插入图片描述
安装syslinux的时候centos8和centos7存在一点不同在后面的后缀-nonlinux在这里插入图片描述
启动相应的三个服务 但是由于dhcp的文件配置还没有配置,所以这里起不来。
在这里插入图片描述

[root@centos8 ~]#ss -ntulp
查看对应端口号

![在这里插入图片描述](https://img-blog.csdnimg.cn/20191114145943475.png

开启HTTP服务

把光盘仓库挂载到web上面 同时做好的应答文件和初始化脚本也可以一起挂载上去

[root@centos8 ~]#cd /var/www/html/

[root@centos8 html]#mkdir centos/{6,7,8}/isos/x86_64/ -pv
mkdir: created directory 'centos'
mkdir: created directory 'centos/6'
mkdir: created directory 'centos/6/isos'
mkdir: created directory 'centos/6/isos/x86_64/'
mkdir: created directory 'centos/7'
mkdir: created directory 'centos/7/isos'
mkdir: created directory 'centos/7/isos/x86_64/'
mkdir: created directory 'centos/8'
mkdir: created directory 'centos/8/isos'
mkdir: created directory 'centos/8/isos/x86_64/'

[root@centos8 html]#tree
.
└── centos
    ├── 6
    │   └── isos
    │       └── x86_64
    ├── 7
    │   └── isos
    │       └── x86_64
    └── 8
        └── isos
            └── x86_64

10 directories, 0 files
[root@centos8 html]#mount /dev/sr0 centos/8/isos/x86_64/
mount: /var/www/html/centos/8/isos/x86_64: WARNING: device write-protected, mounted read-only.
[root@centos8 html]#df
Filesystem     1K-blocks    Used Available Use% Mounted on
devtmpfs          910228       0    910228   0% /dev
tmpfs             924716       0    924716   0% /dev/shm
tmpfs             924716   17508    907208   2% /run
tmpfs             924716       0    924716   0% /sys/fs/cgroup
/dev/nvme0n1p2 104806400 4768644 100037756   5% /
/dev/nvme0n1p3  52403200  398588  52004612   1% /data
/dev/nvme0n1p1    999320  131252    799256  15% /boot
tmpfs             184940       4    184936   1% /run/user/0
/dev/sr0         6967726 6967726         0 100% /var/www/html/centos/8/isos/x86_64
[root@centos8 html]#ls
centos
[root@centos8 html]#mkdir ksdir
[root@centos8 html]#cd ksdir/

把ks8.cfg应答文件拷贝到这个目录下面

[root@centos8 ksdir]#ls
ks8.cfg
[root@centos8 ksdir]#vim ks8.cfg 

# Use graphical install
#repo --name="Appstream"  --baseurl=http://192.168.39.8/centos/8/isos/x86_64/AppStream
url --url=http://192.168.32.8/centos/8/isos/x86_64/
#repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
# Use CDROM installation media
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
network  --bootproto=dhcp --device=ens160 --ipv6=auto --activate
network  --hostname=centos8.kaivi
# Root password
rootpw --iscrypted $6$OOwmaN2kXda4dp0t$oMs3ggugp0xuMknu6TqFyoZNPfka4LDIPftfqn1rrfkNmiQEJtUGPmvU2CbPjo0cvovkt4vBLIQPdb7Uz7vNe1
# 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
user --name=wang --password=$6$oUfb/02CWfLb5l8f$sgEZeR7c7DpqfpmFDH6huSmDbW1XQNR4qKl2EPns.gOXqlnAIgv9pTogtFVaDtEpMOC.SWXKYqxfVtd9MCwxb1 --iscrypted --gecos="wang"
# Disk partitioning information
part / --fstype="xfs" --ondisk=sda --size=102400
part /data --fstype="xfs" --ondisk=sda --size=51200
part swap --fstype="swap" --ondisk=sda --size=2048
part /boot --fstype="ext4" --ondisk=sda --size=1024

%packages
@^minimal-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

%post
curl http://192.168.32.8/reset |bash
yum install vim -y
"ks8.cfg" 60L, 1805C                                     

把脚本也放在共享服务器上面,这里注意应答文件ks8.cfg中安装后脚本的路径要保持一致

[root@centos8 ~]#cd /var/www/html/
[root@centos8 html]#ls
centos  ksdir 
[root@centos8 html]#cp /data/init.sh ./reset
cp: overwrite './reset'? y
[root@centos8 html]#ls
centos  ksdir  reset

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
可以正常访问,http服务正常

配置tftp服务

[root@centos8 ksdir]#cd /var/lib/tftpboot/
[root@centos8 tftpboot]#rpm -ql syslinux-nonlinux 
查找对应的安装包文件。这里我们需要/usr/share/syslinux/menu.c32和/usr/share/syslinux/pxelinux.0
拷贝到 /var/lib/tftpboot/内
[root@centos8 tftpboot]#cp /usr/share/syslinux/menu.c32 .
[root@centos8 tftpboot]#cp /usr/share/syslinux/pxelinux.0 .
[root@centos8 tftpboot]#ls
menu.c32  pxelinux.0

还需要对应的内核启动文件,这些文件在光盘里面有,可以直接拷贝过来

[root@centos8 tftpboot]#ls /var/www/html/centos/8/isos/x86_64/isolinux/
boot.cat  grub.conf   isolinux.bin  ldlinux.c32   libutil.c32  splash.png  vesamenu.c32
boot.msg  initrd.img  isolinux.cfg  libcom32.c32  memtest      TRANS.TBL   vmlinuz

[root@centos8 tftpboot]#cp /var/www/html/centos/8/isos/x86_64/isolinux/vmlinuz .
[root@centos8 tftpboot]#cp /var/www/html/centos/8/isos/x86_64/isolinux/initrd.img .
[root@centos8 tftpboot]#ls
initrd.img  menu.c32  pxelinux.0  vmlinuz

创建一个新的文件夹 pxelinux.cfg,里面用于放置菜单配置文件

[root@centos8 tftpboot]#mkdir pxelinux.cfg
[root@centos8 tftpboot]#cp /var/www/html/centos/8/isos/x86_64/isolinux/isolinux.cfg pxelinux.
pxelinux.0    pxelinux.cfg/ 
[root@centos8 tftpboot]#cp /var/www/html/centos/8/isos/x86_64/isolinux/isolinux.cfg pxelinux.
pxelinux.0    pxelinux.cfg/ 
[root@centos8 tftpboot]#cp /var/www/html/centos/8/isos/x86_64/isolinux/isolinux.cfg pxelinux.cfg/default
拷贝过来改名为default

[root@centos8 tftpboot]#vim /var/lib/tftpboot/pxelinux.cfg/default 
default menu.c32
timeout 600

menu title CentOS Linux 8

label linux
  menu label ^Auto Install CentOS Linux 8.0 mini
  kernel vmlinuz
  append initrd=initrd.img ks=http://192.168.32.8/ksdir/ks8.cfg

label manual
  menu label ^Manual Install CentOS Linux 8.0
  kernel vmlinuz
  append initrd=initrd.img inst.repo=http://192.168.32.8/centos/8/isos/x86_64/

menu separator # insert an empty line


label local
   menu default
  menu label Boot from ^local drive
  localboot 0xffff

[root@centos8 tftpboot]#cp /var/www/html/centos/8/isos/x86_64/isolinux/ldlinux.c32 .
[root@centos8 tftpboot]#cp /var/www/html/centos/8/isos/x86_64/isolinux/libutil.c32 .
[root@centos8 tftpboot]#cp /var/www/html/centos/8/isos/x86_64/isolinux/libcom32.c32 .
centos 7上面以上三个可以不要  但是centos8上面对于上面三个文件有一定的依赖性,所以也要一起拷贝过来
[root@centos8 tftpboot]#tree
.
├── initrd.img
├── ldlinux.c32
├── libcom32.c32
├── libutil.c32
├── menu.c32
├── pxelinux.0
├── pxelinux.cfg
│   └── default
└── vmlinuz

1 directory, 8 files

到这里tftp服务就配置好了

配置DHCP服务

[root@centos8 tftpboot]#systemctl start dhcpd
Job for dhcpd.service failed because the control process exited with error code.
See "systemctl status dhcpd.service" and "journalctl -xe" for details.
报错是因为没有配置/etc/dhcp/dhcpd.conf 这个文件暂时为空。需要复制参考文件
[root@centos8 tftpboot]#cp /usr/share/doc/dhcp-server/dhcpd.conf.example /etc/dhcp/dhcpd.conf 
cp: overwrite '/etc/dhcp/dhcpd.conf'? y

[root@centos8 tftpboot]#vim /etc/dhcp/dhcpd.conf 
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers 180.76.76.76, 114.114.114.114;

default-lease-time 84600;
max-lease-time 100000;

# 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.

# This is a very basic subnet declaration.

subnet 192.168.32.0 netmask 255.255.255.0 {
    
  range 192.168.32.100 192.168.32.200;
  option routers 192.168.32.2;
  next-server 192.168.32.8;
  filename "pxelinux.0";
}
~          

重启服务即可

[root@centos8 ~]#systemctl restart dhcpd
[root@centos8 ~]#systemctl status dhcpd
● dhcpd.service - DHCPv4 Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-11-14 14:12:29 CST; 5s ago
     Docs: man:dhcpd(8)
           man:dhcpd.conf(5)
 Main PID: 10692 (dhcpd)
   Status: "Dispatching packets..."
    Tasks: 1 (limit: 11377)
   Memory: 5.1M
   CGroup: /system.slice/dhcpd.service
           └─10692 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid

Nov 14 14:12:29 centos8 dhcpd[10692]: ** Ignoring requests on virbr0.  If this is not what
Nov 14 14:12:29 centos8 dhcpd[10692]: you want, please write a subnet declaration
Nov 14 14:12:29 centos8 dhcpd[10692]: in your dhcpd.conf file for the network segment
Nov 14 14:12:29 centos8 dhcpd[10692]: to which interface virbr0 is attached. **
Nov 14 14:12:29 centos8 dhcpd[10692]: 
Nov 14 14:12:29 centos8 dhcpd[10692]: Listening on LPF/eth0/00:0c:29:fe:da:42/192.168.32.0/24
Nov 14 14:12:29 centos8 dhcpd[10692]: Sending on   LPF/eth0/00:0c:29:fe:da:42/192.168.32.0/24
Nov 14 14:12:29 centos8 dhcpd[10692]: Sending on   Socket/fallback/fallback-net
Nov 14 14:12:29 centos8 dhcpd[10692]: Server starting service.
Nov 14 14:12:29 centos8 systemd[1]: Started DHCPv4 Server Daemon.
[root@centos8 ~]#

PEX自动化安装就配置好了

安装新系统

现在去安装一个新的centos8的系统
在这里插入图片描述
选择菜单

在这里插入图片描述

在这里插入图片描述
安装成功
在这里插入图片描述
脚本运行成功

扩展同时配置加载安装centos6 和 centos 7

需要安装什么系统,对应的光盘同样需要挂载上去
在这里插入图片描述在这里插入图片描述
查看web服务器上是否挂载
在这里插入图片描述在这里插入图片描述

现在配置应答文件,这里用之前已经做好的应答文件

[root@centos8 html]#cd /var/www/html/
[root@centos8 html]#ls
centos  ksdir  reset
[root@centos8 html]#cd ksdir/
[root@centos8 ksdir]#ls
ks8.cfg
[root@centos8 ksdir]#rz -E
rz waiting to receive.
[root@centos8 ksdir]#ls
ks6.cfg  ks7.cfg  ks8.cfg

修改对应的应答文件 特别是注意路径

[root@centos8 ksdir]#vim ks7.cfg 
[root@centos8 ksdir]#vim ks6.cfg 
[root@centos8 ksdir]#ll
-rw-r--r-- 1 root root 1235 Nov 14 16:13 ks6.cfg
-rw-r--r-- 1 root root 1435 Nov 14 16:09 ks7.cfg
-rw-r--r-- 1 root root 1805 Nov 14 14:35 ks8.cfg

在这里插入图片描述
在网页需要分别能打开对应的应答文件,不然就是权限问题 需要设置一下权限

设置tftp配置文件

[root@centos8 tftpboot]#ls
initrd.img  ldlinux.c32  libcom32.c32  libutil.c32  menu.c32  pxelinux.0  pxelinux.cfg  vmlinuz

创建分别放置不同操作系统的目录6 7 8.用来放置不同的内核文件

[root@centos8 tftpboot]#mkdir {6,7,8}
[root@centos8 tftpboot]#mv vmlinuz initrd.img 8/

[root@centos8 tftpboot]#cp /var/www/html/centos/7/isos/x86_64/isolinux/vmlinuz ./7/
[root@centos8 tftpboot]#cp /var/www/html/centos/7/isos/x86_64/isolinux/initrd.img ./7/


[root@centos8 tftpboot]#cp /var/www/html/centos/6/isos/x86_64/isolinux/vmlinuz ./6/
[root@centos8 tftpboot]#cp /var/www/html/centos/6/isos/x86_64/isolinux/initrd.img ./6/
[root@centos8 tftpboot]#tree
.
├── 6
│   ├── initrd.img
│   └── vmlinuz
├── 7
│   ├── initrd.img
│   └── vmlinuz
├── 8
│   ├── initrd.img
│   └── vmlinuz
├── ldlinux.c32
├── libcom32.c32
├── libutil.c32
├── menu.c32
├── pxelinux.0
└── pxelinux.cfg
    └── default

4 directories, 12 files

修改菜单项 注意路径 是相对路径

[root@centos8 tftpboot]#vim pxelinux.cfg/default 

default menu.c32
timeout 600

menu title CentOS Linux

label linux8
  menu label Auto Install CentOS Linux ^8.0 mini
  kernel 8/vmlinuz
  append initrd=8/initrd.img ks=http://192.168.32.8/ksdir/ks8.cfg

label linux7
  menu label Auto Install CentOS Linux ^7.0 mini
  kernel 7/vmlinuz
  append initrd=7/initrd.img ks=http://192.168.32.8/ksdir/ks7.cfg

label linux6
  menu label Auto Install CentOS Linux ^6.0 mini
  kernel 6/vmlinuz
  append initrd=6/initrd.img ks=http://192.168.32.8/ksdir/ks6.cfg


label manual
  menu label Manual Install CentOS Linux 8.0
  kernel vmlinuz
  append initrd=initrd.img inst.repo=http://192.168.32.8/centos/8/isos/x86_64/

menu separator # insert an empty line


label local
   menu default
  menu label Boot from ^local drive
  localboot 0xffff

参考文献如下

在这里插入图片描述在这里插入图片描述
在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_45651006/article/details/103067283

智能推荐

python opencv resize函数_python opencv 等比例调整(缩放)图片分辨率大小代码 cv2.resize()...-程序员宅基地

文章浏览阅读1.3k次。# -*- coding: utf-8 -*-"""@File : 200113_等比例调整图像分辨率大小.py@Time : 2020/1/13 13:38@Author : Dontla@Email : [email protected]@Software: PyCharm"""import cv2def img_resize(image):height, width = image...._opencv小图等比例缩放

【OFDM、OOK、PPM、QAM的BER仿真】绘制不同调制方案的误码率曲线研究(Matlab代码实现)-程序员宅基地

文章浏览阅读42次。对于这些调制技术的误码率(BER)研究是非常重要的,因为它们可以帮助我们了解在不同信道条件下系统的性能表现。通过以上步骤,您可以进行OFDM、OOK、PPM和QAM的误码率仿真研究,并绘制它们的误码率曲线,以便更好地了解它们在不同信道条件下的性能特点。针对这些调制技术的BER研究是非常重要的,可以帮助我们更好地了解这些技术在不同信道条件下的性能表现,从而指导系统设计和优化。6. 分析结果:根据误码率曲线的比较,分析每种调制方案在不同信噪比条件下的性能,包括其容忍的信道条件和适用的应用场景。_ber仿真

【已解决】Vue的Element框架,日期组件(el-date-picker)的@change事件,不会触发。_el-date-picker @change不触发-程序员宅基地

文章浏览阅读2.5w次,点赞3次,收藏3次。1、场景照抄官方的实例,绑定了 myData.Age 这个值。实际选择某个日期后,从 vuetool(开发工具)看,值已经更新了,但视图未更新。2、尝试绑定另一个值: myData,可以正常的触发 @change 方法。可能是:值绑定到子对象时,组件没有侦测到。3、解决使用 @blur 代替 @change 方法。再判断下 “值有没有更新” 即可。如有更好的方法,欢迎评论!..._el-date-picker @change不触发

PCL学习:滤波—Projectlnliers投影滤波_projectinliers-程序员宅基地

文章浏览阅读1.5k次,点赞2次,收藏8次。Projectlnliersclass pcl: : Projectlnliers< PointT >类 Projectlnliers 使用一个模型和一组的内点的索引,将内点投影到模型形成新的一个独立点云。关键成员函数 void setModelType(int model) 通过用户给定的参数设置使用的模型类型 ,参数 Model 为模型类型(见 mo..._projectinliers

未处理System.BadImageFormatException”类型的未经处理的异常在 xxxxxxx.exe 中发生_“system.badimageformatexception”类型的未经处理的异常在 未知模块。 -程序员宅基地

文章浏览阅读2.4k次。“System.BadImageFormatException”类型的未经处理的异常在 xxxx.exe 中发生其他信息: 未能加载文件或程序集“xxxxxxx, Version=xxxxxx,xxxxxxx”或它的某一个依赖项。试图加载格式不正确的程序。此原因是由于 ” 目标程序的目标平台与 依赖项的目标编译平台不一致导致,把所有的项目都修改到同一目标平台下(X86、X64或AnyCPU)进行编译,一般即可解决问题“。若果以上方式不能解决,可采用如下方式:右键选择配置管理器,在这里修改平台。_“system.badimageformatexception”类型的未经处理的异常在 未知模块。 中发生

PC移植安卓---2018/04/26_电脑软件移植安卓-程序员宅基地

文章浏览阅读2.4k次。记录一下碰到的问题:1.Assetbundle加载问题: 原PC打包后的AssetBundle导入安卓工程后,加载会出问题。同时工程打包APK时,StreamingAssets中不能有中文。解决方案: (1).加入PinYinConvert类,用于将中文转换为拼音(多音字可能会出错,例如空调转换为KongDiao||阿拉伯数字不支持,如Ⅰ、Ⅱ、Ⅲ、Ⅳ(IIII)、Ⅴ、Ⅵ、Ⅶ、Ⅷ、Ⅸ、Ⅹ..._电脑软件移植安卓

随便推点

聊聊线程之run方法_start 是同步还是异步-程序员宅基地

文章浏览阅读2.4k次。话不多说参考书籍 汪文君补充知识:start是异步,run是同步,start的执行会经过JNI方法然后被任务执行调度器告知给系统内核分配时间片进行创建线程并执行,而直接调用run不经过本地方法就是普通对象执行实例方法。什么是线程?1.现在几乎百分之百的操作系统都支持多任务的执行,对计算机来说每一个人物就是一个进程(Process),在每一个进程内部至少要有一个线程实在运行中,有时线..._start 是同步还是异步

制作非缘勿扰页面特效----JQuery_单击标题“非缘勿扰”,<dd>元素中有id属性的<span>的文本(主演、导演、标签、剧情-程序员宅基地

文章浏览阅读5.3k次,点赞9次,收藏34次。我主要用了层次选择器和属性选择器可以随意选择,方便简单为主大体CSS格式 大家自行构造网页主体<body> <div class='main' > <div class='left'> <img src="images/pic.gif" /> <br/><br/> <img src="images/col.gif" alt="收藏本片"/&_单击标题“非缘勿扰”,元素中有id属性的的文本(主演、导演、标签、剧情

有了这6款浏览器插件,浏览器居然“活了”?!媳妇儿直呼“大开眼界”_浏览器插件助手-程序员宅基地

文章浏览阅读901次,点赞20次,收藏23次。浏览器是每台电脑的必装软件,去浏览器搜索资源和信息已经成为我们的日常,我媳妇儿原本也以为浏览器就是上网冲浪而已,哪有那么强大,但经过我的演示之后她惊呆了,直接给我竖起大拇指道:“原来浏览器还能这么用?大开眼界!今天来给大家介绍几款实用的浏览器插件,学会之后让你的浏览器“活过来”!_浏览器插件助手

NumPy科学数学库_数学中常用的环境有numpy-程序员宅基地

文章浏览阅读101次。NumPy是Python中最常用的科学数学计算库之一,它提供了高效的多维数组对象以及对这些数组进行操作的函数NumPy的核心是ndarray(N-dimensional array)对象,它是一个用于存储同类型数据的多维数组Numpy通常与SciPy(Scientific Python)和 Matplotlib(绘图库)一起使用,用于替代MatLabSciPy是一个开源的Python算法库和数学工具包;Matplotlib是Python语言及其Numpy的可视化操作界面'''_数学中常用的环境有numpy

dind(docker in docker)学习-程序员宅基地

文章浏览阅读1.1w次。docker in docker说白了,就是在docker容器内启动一个docker daemon,对外提供服务。优点在于:镜像和容器都在一个隔离的环境,保持操作者的干净环境。想到了再补充 :)一:低版本启动及访问启动1.12.6-dinddocker run --privileged -d --name mydocker docker:1.12.6-dind在其他容器访问d..._dind

推荐文章

热门文章

相关标签