传统bios引导-批量装机

1、yum install dhcp tftp-server httpd syslinux xinetd net-tools -y

2、编辑/etc/xinetd.d/tftp

  service tftp
  {
  socket_type = dgram
  protocol = udp
  wait = yes
  user = root
  server = /usr/sbin/in.tftpd
  server_args = -s /var/lib/tftpboot
  disable = no (由yes改为no)
  per_source = 11
  cps = 100 2
  flags = IPv4
  }

 3、systemctl start xinetd && systemctl enable xinetd

 4、netstat -lantuep |grep 69

 5、cd /var/lib/tftpboot/

 6、ls

 7、cp /usr/share/syslinux/pxelinux.0 .

 8、mkdir pxelinux.cfg

 9、ls

  pxelinux.0  pxelinux.cfg

 10、setenforce 0

 11、编辑/etc/selinux/config

  # This file controls the state of SELinux on the system.
  # SELINUX= can take one of these three values:
  #     enforcing - SELinux security policy is enforced.
  #     permissive - SELinux prints warnings instead of enforcing.
  #     disabled - No SELinux policy is loaded.
  SELINUX=disabled (由enforcing改为disabled)
  # SELINUXTYPE= can take one of three values:
  #     targeted - Targeted processes are protected,
  #     minimum - Modification of targeted policy. Only selected processes are protected.
  #     mls - Multi Level Security protection.
  SELINUXTYPE=targeted
 12、systemctl stop firewalld && systemctl disable firewalld

 13、cp /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf

 14、编辑/etc/dhcp/dhcpd.conf

  subnet 172.16.190.0 netmask 255.255.255.0 {
    range 172.16.190.11 172.16.190.249;
    option routers 172.16.190.254;
    option broadcast-address 172.16.190.255;
    default-lease-time 600;
    max-lease-time 7200;
    filename "pxelinux.0";
    next-server 172.16.190.101;
  }


 15、systemctl start dhcpd && systemctl disable dhcpd
 16、cp /mnt/images/pxeboot/* /var/lib/tftpboot/

 17、cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

 18、编辑/var/lib/tftpboot/pxelinux.cfg/default 修改第1、61、64行,如下:

  default centos76
  label centos76
    menu label ^Install CentOS 7
    kernel vmlinuz
    append initrd=initrd.img ks=http://172.16.190.101/centos76.cfg
 19、mkdir /var/www/html/centos76

 20、编辑/etc/fstab

  /root/CentOS-7.6-x86_64-Everything-1810.iso /var/www/html/centos76 iso9660 defaults 0 0

 21、systemctl start httpd && systemctl enable httpd

 22、chown apache:apache centos76.cfg && chown apache:apache ip.txt

 

 






 

posted @ 2021-08-28 11:25  汝南  阅读(89)  评论(0)    收藏  举报