博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PXE 部署不同版本的系统安装环境以及挽救环境
阅读量:6392 次
发布时间:2019-06-23

本文共 6616 字,大约阅读时间需要 22 分钟。

环境Redhat7.3


软件准本工作:

[root@localhost ~]# yum install httpd tftp-server dhcpd syslinux system-config-kickstart -y

软件环境的逐个配置:

1.httpd :

***

1  [root@localhost ~] mkdir /var/www/html/redhat73  2  [root@localhost ~] mkdir /var/www/html/redhat72  3  [root@localhost ~] mkdir /var/www/html/redhat68  4  [root@localhost ~] mount /iso/rhel-server7.2****.iso /var/www/html/redhat72  5  [root@localhost ~] mount /iso/rhel-server7.3***.iso /var/www/html/redhat73  6  [root@localhost ~] mount /iso/rhel-server6.8***.iso /var/www/html/redhat68  7  [root@localhost ~] service httpd start  8  [root@localhost ~] chkconfig httpd on

2.system-config-kickstart:

在shell中直接运行软将名字,按照一步步的配置即可,最后把ks.cfg文件保存到httpd共享的不同目录下,可以用ksvalidator命令检查语法错误,中共配合三个ks文件分别保存在/var/www/html/ks7,ks72,ks68目录下

3.tftp-server:

[root@localhost ~]# vim /etc/xinetd.d/tftp 13         server_args             = -s /var/lib/tftpboot 14         disable                 = no  #yes修改为no 15         per_source              = 11 16         cps                     = 100 2[root@localhost linux]# cd /var/lib/tftpboot/[root@localhost tftpboot]# cp /var/www/html/redhat72/isolinux/vmlinuz redhat72/[root@localhost tftpboot]# cp /var/www/html/source/redhat72/isolinux/initrd.img redhat72/#redhat6.8和redhat7.3一样,从挂载镜像中将initrd.img,vmlinuz 复制到http共享目录中的对应文件夹[root@localhost tftpboot]# mkdir pxelinux.cfg [root@localhost tftpboot]# cp /var/www/html/redhat73/isolinux/isolinux.cfg ./pxelinux.cfg/default[root@localhost tftpboot]# cp /var/www/html/source/redhat73/isolinux/vesamenu.c32 .#isolinux.cfg和vesamenu.c32任意一个系统的考个iuolai都可以[root@localhost tftpboot]# cp /usr/share/syslinux/pxelinux.0 .#pxelinux.0 此文件是在安装主机获得dhcp分配的ip以后要读取的文件[root@localhost tftpboot]# cat pxelinux.cfg/defaultdefault vesamenu.c32timeout 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 clearmenu background splash.pngmenu title Red Hat Enterprise Linux 7.3menu vshift 8menu rows 18menu margin 8#menu hiddenmenu helpmsgrow 15menu tabmsgrow 13# Border Areamenu color border * #00000000 #00000000 none# Selected itemmenu color sel 0 #ffffffff #00000000 none# Title barmenu color title 0 #ff7ba3d0 #00000000 none# Press [Tab] messagemenu color tabmsg 0 #ff3a6496 #00000000 none# Unselected menu itemmenu color unsel 0 #84b8ffff #00000000 none# Selected hotkeymenu color hotsel 0 #84b8ffff #00000000 none# Unselected hotkeymenu color hotkey 0 #ffffffff #00000000 none# Help textmenu color help 0 #ffffffff #00000000 none# A scrollbar of some type? Not sure.menu color scrollbar 0 #ffffffff #ff355594 none# Timeout msgmenu color timeout 0 #ffffffff #00000000 nonemenu color timeout_msg 0 #ffffffff #00000000 none# Command prompt textmenu color cmdmark 0 #84b8ffff #00000000 nonemenu 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 linemenu separator # insert an empty line########################################################################################### INSTALL CONFIG OPTION BEGIN ######################################################################################################label linux  menu label ^Install RedHat 7.3 Linux   kernel redhat73/vmlinuz  append initrd=redhat73/initrd.img  ks=http://192.168.1.100/ks7/ks.cfg    *#次数不再需要写repo地址了,因为在ks.cfg文件中已经指定了从哪里获取相应的镜像,也指定了安装过程中的各种选择*label linux  menu label ^Install RedHat 7.2 Linux #此处也必须要指定内核文件的准确位置,默认读取的内核文件在tftpboot下,此处我们部署的是多个版本,故具体版本读取相应目录下的文件  menu default  append initrd=redhat72/initrd.img  ks=http://192.168.1.100/ks72/ks.cfg label linux  menu label  ^Install RedHat 6.8 Linux  kernel redhat68/vmlinuz  append initrd=redhat68/initrd.img  ks=http://192.168.1.100/ks6/ksmini.cfg ############# END LINE FOR LEBEL INSTALL OPTIONS ##################################################################################################### Rescue Mode for all options config     ############################################################ utilities submenumenu begin ^Rescue Mode  menu title Rescue Mode label rescue  menu indent count 5  menu label ^Rescue mode for RedHat 7.3   text help    If the system will not boot, this lets you access files    and edit config files to try to get it booting again.  endtext  kernel redhat73/vmlinuz  append initrd=redhat73/initrd.img repo=http://192.168.1.100/source/redhat73 rescue quiet#挽救环境必须写repo地址,此处不是安装,故也不需要ks文件,所以此处必须指定从哪里获取挽救环境所需要的资源 label rescue  menu indent count 5  menu label ^Rescue mode for RedHat 7.2   text help    If the system will not boot, this lets you access files    and edit config files to try to get it booting again.  endtext  kernel redhat72/vmlinuz  append initrd=redhat72/initrd.img repo=http://192.168.1.100/source/redhat72 rescue quiet label rescue  menu indent count 5  menu label ^Rescue mode for RedHat 6.8   text help    If the system will not boot, this lets you access files    and edit config files to try to get it booting again.  endtext  kernel redhat68/vmlinuz  append initrd=redhat68/initrd.img repo=http://192.168.1.100/source/redhat68  rescue quietlabel returntomain  menu label Return to ^main menu  menu exitmenu end###################### END LINE FOR RESCUE MODE ########################################[root@localhost ~]# systemctl start tftp[root@localhost ~]# systemctl enable tftp

dhcpd的配置:

[root@localhost tftpboot]# cat /etc/dhcp/dhcpd.conf |grep -v '#' option domain-name "example.com";option domain-name-servers 192.168.1.100;default-lease-time 600;max-lease-time 7200;log-facility local7;subnet 192.168.1.0 netmask 255.255.255.0 {  range 192.168.1.20 192.168.1.99;  option routers 192.168.1.250;  next-server 192.168.1.100;  filename "pxelinux.0";}

配置完成了必须考虑到防火墙,不然防火墙会把httpd共享和tftp都阻塞,进而服务端访问不到,当然关闭防火墙一切搞定,这样肯定不安全,我不喜欢这样,所以作一下防火墙策略ok:

[root@localhost tftpboot]# firewall-cmd --add-service=httpd --permanent [root@localhost tftpboot]# firewall-cmd --add-service=tftp --permanent [root@localhost tftpboot]# firewall-cmd --list-allpublic (active)  target: default  icmp-block-inversion: no  interfaces: br0 enp8s0 wlp9s0  sources:   services: dhcpv6-client ftp http ssh tftp ##说明添加上了  ports: 4505/tcp 4506/tcp  protocols:   masquerade: yes  forward-ports:   sourceports:   icmp-blocks:   rich rules:     rule family="ipv4" source address="192.168.0.10" masquerade

这里写图片描述

这里写图片描述
这里写图片描述

转载于:https://www.cnblogs.com/petersonx/p/11023107.html

你可能感兴趣的文章
执行./configure报checking for g++... no错误
查看>>
Dojo学习笔记(十一):Dojo布局——嵌套样例
查看>>
Appium for Android元素定位方法
查看>>
pfSense LAGG(链路聚合)设置
查看>>
教学思路SQL之入门习题《学生成绩》 七.存储过程基础知识
查看>>
createrepo 无法使用解决
查看>>
.net安全类库
查看>>
tablespace backup模式一个没用的技术
查看>>
PostgreSQL安装
查看>>
七牛实时音视频云视频连线demo(web部分)
查看>>
Mysql 权限
查看>>
Spring事务管理(详解+实例)
查看>>
ubuntu apt-get install 出现无法定位软件包...
查看>>
centos7 下 基于docker搭建java/tomcat (方式一)
查看>>
全世界最好的编辑器VIM之Windows配置(gvim)[未测试]
查看>>
2018年你需要知道的13个JavaScript工具库
查看>>
当你点击按钮的时候如何设置其他按钮不可点击
查看>>
spring 高级装配
查看>>
【合集】parasoft Jtest 从安装到使用教程合集,收藏推荐!
查看>>
Python Pygame库的学习之路(1)
查看>>