运维高级 pxe部署

[root@localhost ~]# grubby --update-kernel ALL --args selinux=0 关闭SLinux

[root@localhost ~]# reboot  重启

[root@localhost ~]# systemctl stop firewalld       关闭防火墙

[root@localhost ~]# systemctl mask firewalld 

Created symlink /etc/systemd/system/firewalld.service → /dev/null.

[root@localhost ~]# systemctl start firewalld

Failed to start firewalld.service: Unit firewalld.service is masked.

[root@localhost ~]# mkdir /rhel7

[root@localhost ~]# mount /dev/sr0 /rhel7/

[root@localhost ~]# df

[root@localhost ~]# vim /etc/rc.d/rc.local

[root@localhost ~]# chmod +x /etc/rc.d/rc.local

[root@localhost ~]# cd /etc/yum.repos.d/

[root@localhost ~]# ls

[root@localhost ~]# mv redhat.repo redhat.repo.bak

[root@localhost ~]# vim rhel7.repo

[rhel7]

name=rhel7

baseurl=file:///rhel7

gpgcheck=0

[root@localhost ~]# yum makecache

[root@localhost ~]# yum install system-config-kickstart   安装图形化生成kickstart自动安装脚本的工具。

[root@localhost ~]# system-config-kickstart     启动图形制作工具,不建议用远程连接

根据自己本机ip设定

[root@localhost ~]# vim ks.cfg

part /boot --fstype="xfs" --size=1024

part swap --fstype="swap" --size=512

part / --fstype="xfs" --grow --maxsize=1 --size=1

%packages

@base

httpd

%end

[root@localhost ~]# ksvalidator ks.cfg  检测文件

下载http服务

[root@localhost ~]# yum install httpd.x86_64 -y  下载http服务

[root@localhost ~]# systemctl enable --now httpd   开机启动

[root@localhost ~]# vim /etc/httpd/conf/httpd.conf   编辑主配置文件

102 <Directory "/var/www/html">

103     #AllowOverride none

104     Require all denied

105 </Directory>

[root@localhost ~]# systemctl restart httpd   重启服务

[root@localhost ~]# cd /var/www/html/     发布目录

[root@localhost html]# ls

ks.cfg  rhel7

关闭DHCP服务。

[root@localhost ~]# yum install dhcp -y  下载DHCP服务

[root@localhost ~]# rpm -qc dhcp         查看文件

[root@localhost ~]# cat /etc/dhcp/dhcpd.conf    主配置文件

[root@localhost ~]# \cp -f /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf                   生成文件

[root@localhost ~]# vim /etc/dhcp/dhcpd.conf        编辑主配置文件

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

[root@localhost ~]# yum install syslinux.x86_64

[root@localhost ~]# yum install tftp-server.x86_64 -y   共享pxelinux.0数据文件的网络服务

[root@localhost ~]# cp /rhel7/isolinux/* /var/lib/tftpboot/

[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

[root@localhost ~]# cd /var/lib/tftpboot/

[root@localhost tftpboot]# ls

boot.cat  grub.conf   isolinux.bin  memtest     pxelinux.cfg  TRANS.TBL    vesamenu.c32

boot.msg  initrd.img  isolinux.cfg  pxelinux.0  splash.png    upgrade.img  vmlinuz

[root@localhost tftpboot]# cp isolinux.cfg pxelinux.cfg/default

编辑指向下一个服务器的ip和读取文件

[root@localhost ~]# vim /etc/dhcp/dhcpd.conf                       DHCP主配置文件。

[root@localhost ~]# vim /var/lib/tftpboot/pxelinux.cfg/default 

menu separator # insert an empty line
menu separator # insert an empty line

label linux
  menu label ^Install Red Hat Enterprise Linux prq nihao
  menu default
  kernel vmlinuz
  append initrd=initrd.img repo=http://172.25.254.138/rhel7 ks=http://172.25.254.138/ks.cfg quiet

label check
  menu label Test this ^media & install Red Hat Enterprise Linux 7.9

测试:

按下回车键。

按下TAB键。

按回车键。

等待无需任何操作。

pxe功能测试成功。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值