pxe实验

环境配置

1.rhel7主机   配置网络

2开启图形

[root@localhost ~]yum -y groupinstall "Server with GUI"   #下载
[root@localhost ~]init 5   #开启图形

3.关闭DHCP功能

环境配置

实验步骤

安装并启动kickstart

[root@localhost ~]# yum install system-config-kickstart

[root@localhost ~]# system-config-kickstart

程序配置

[root@localhost ~]# ln -s /rhel7 /var/www/html/
[root@localhost ~]# cd /var/www/html/

文件保存至/root  文件名为ks.cfg

[root@localhost ~]# ksvalidator ks.cfg    #检查文件完整性
[root@localhost ~]# cp /root/ks.cfg /var/www/html/    #移动文件

访问ks.cfg 和 rhel7

搭建DHCP服务测试kickstart脚本

[root@localhost ~]# yum install dhcp -y

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

删除37行以下内容

6 # option definitions common to all supported networks..

7option domain-name "lr.orgs"

8 optiondomain-name-server144.144.144.144

32 subnet 172.25.254.0  netmask 255.255.255.0{

33 range 172.25.254.30 172.25.254.40;

34 option routers 172.25.254.2,

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

搭建pxe网络安装环境实现服务器自动部署

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

[root@localhost ~]# yum install tftp-server.x86_64 -y

[root@localhost ~]# systemctl enable --now tftp
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.

[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     splash.png  upgrade.img   vmlinuz
boot.msg  initrd.img  isolinux.cfg  pxelinux.0  TRANS.TBL   vesamenu.c32
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# cp isolinux.cfg  pxelinux.cfg/default
[root@localhost tftpboot]# vim /etc/dhcp/dhcpd.conf

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

[root@localhost ~]# vim /etc/dhcp/dhcpd.conf

修改内容

[root@localhost tftpboot]# systemctl restart dhcpd

[root@localhost tftpboot]# systemctl restart tftp

最后虚拟机测试

打开电脑时进入固件然后修改以下挪到第一位(shift+)然后退出

  • 20
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值