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

打印 上一主题 下一主题

主题 541|帖子 541|积分 1623

  1. [root@pxe ~]# hostnamectl
  2.    Static hostname: pxe.timinglee.org
  3.          Icon name: computer-vm
  4.            Chassis: vm
  5.         Machine ID: 380f481f1fef42d7ab5705f1fca7b016
  6.            Boot ID: 3ffde0969f6f4203b3a86ba00700d7e4
  7.     Virtualization: vmware
  8.   Operating System: Red Hat Enterprise Linux Server 7.9 (Maipo)
  9.        CPE OS Name: cpe:/o:redhat:enterprise_linux:7.9:GA:server
  10.             Kernel: Linux 3.10.0-1160.el7.x86_64
  11.       Architecture: x86-64
  12. # 查看有没有pxe
  13. [root@pxe ~]# yum search pxelinux
  14. [root@pxe ~]# yum install syslinux.x86_64
  15. [root@pxe ~]# yum install tftp-server.x86_64
  16. [root@pxe ~]# rpm -ql tftp-server
  17. [root@pxe ~]# systemctl enable --now tftp
  18. [root@pxe ~]# netstat -antluple
  19. [root@pxe ~]# systemctl enable --now tftp
  20. [root@pxe ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
  21. [root@pxe ~]# cd /var/lib/tftpboot/
  22. [root@pxe tftpboot]# ls
  23. boot.cat   initrd.img    memtest     TRANS.TBL     vmlinuz
  24. boot.msg   isolinux.bin  pxelinux.0  upgrade.img
  25. grub.conf  isolinux.cfg  splash.png  vesamenu.c32
  26. # 创建pxelinux.cfg
  27. [root@pxe tftpboot]# mkdir pxelinux.cfg
  28. [root@pxe tftpboot]# cp isolinux.cfg pxelinux.cfg/default
  29. # 修改dhcp文件
  30. [root@pxe tftpboot]# vim /etc/dhcp/dhcpd.conf
  31. subnet 172.25.254.0 netmask 255.255.255.0 {
  32.   range 172.25.254.30 172.25.254.40;
  33.   option routers 172.25.254.0;
  34.   next-server 172.25.254.100;
  35.   filename "pxelinux.0";
  36. [root@pxe tftpboot]# systemctl restart dhcpd
  37. # 修改default文件
  38. [root@pxe ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
  39. default vesamenu.c32
  40. timeout 30
  41. label linux
  42.   menu label ^Install Red Hat Enterprise Linux hahahahha
  43.   menu default
  44.   kernel vmlinuz
  45.   append initrd=initrd.img repo=http://172.25.254.100/rhel7 ks=http://172.25.254.100/ks.cfg quiet
  46. [root@pex ~]# systemctl enable --now dhcpd
  47. ### 新建立一个虚拟机进行测试
复制代码



免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

正序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

小秦哥

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表