zoukankan      html  css  js  c++  java
  • Linux系统PXE高效批量网络装机的配置

    Linux系统PXE高效批量网络装机的配置

    配置环境:

    服务器IP地址为192.168.1.10,所在网段为192.168.1.0/24;

    一、首先需要准备系统安装源

    [root@www ~]# mkdir -pv /var/ftp/centos6/
    [root@www ~]# cp -rf /media/cdrom/* /var/ftp/centos6/

    二、部署FTP服务

    [root@www ~]# yum -y install vsftpd
    [root@www ~]# service vsftpd start

    三、部署TFTP服务

    [root@www ~]# yum -y install tftp-server

    编辑 /etc/xinetd.d/tftp配置文件,将disable=yes改为disable=no 重启xinetd服务即可。

    # default: off
    # description: The tftp server serves files using the trivial file transfer 
    #       protocol.  The tftp protocol is often used to boot diskless 
    #       workstations, download configuration files to network-aware printers, 
    #       and to start the installation process for some operating systems.
    service tftp
    {
            socket_type             = dgram
            protocol                = udp
            wait                    = no   //把yes改为no  
            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
    }

    启动服务

    [root@www ~]# service xinetd start

    四、准备linux内核和初始化文件。

    Linux内核和初始化镜像文件可以从linux镜像中找到,位于文件夹/images/pxeboot中,将vmlinuz和initrd.img复制到tftp的根目录/var/lib/tftpboot/下

    Vmlinuz:linux内核                    

    initrd.img:初始化镜像文件

    [root@www ~]# cd /media/cdrom/images/pxeboot/
    [root@www pxeboot]# ls
    initrd.img  TRANS.TBL  vmlinuz
    [root@www pxeboot]# cp vmlinuz initrd.img /var/lib/tftpboot/

    五、接下来在准备PEX引导程序,启动菜单文件

    Linux引导程序为pxelinux.0 该文件由syslinux软件包提供,因此我们要安装syslinux软件包,并复制到tftp根目录下

    [root@www ~]# yum -y install syslinux
    [root@www ~]# cd /usr/share/syslinux/
    [root@www syslinux]# cp pxelinux.0 /var/lib/tftpboot/

    默认的启动菜单为default,该文件应该放置在tftp根目录的pxelinux.cfg中,并重命名为default。

    [root@www ~]# cd /media/cdrom/
    [root@www cdrom]# ls
    CentOS_BuildTag  isolinux                  RPM-GPG-KEY-CentOS-Debug-6
    EFI              Packages                  RPM-GPG-KEY-CentOS-Security-6
    EULA             RELEASE-NOTES-en-US.html  RPM-GPG-KEY-CentOS-Testing-6
    GPL              repodata                  TRANS.TBL
    images           RPM-GPG-KEY-CentOS-6
    [root@www cdrom]# cd isolinux/
    [root@www isolinux]# ls
    boot.cat  grub.conf   isolinux.bin  memtest     TRANS.TBL     vmlinuz
    boot.msg  initrd.img  isolinux.cfg  splash.jpg  vesamenu.c32
    [root@www isolinux]# cp isolinux.cfg /var/lib/tftpboot/
    [root@www syslinux]# cd /var/lib/tftpboot/
    [root@www tftpboot]# mkdir pxelinux.cfg
    [root@www tftpboot]# cp isolinux.cfg pxelinux.cfg/default

    修改default文件内容如下:

    default linux       //名字随便起
    prompt 0           //0表示自动选择,1表示等待用户确认
    timeout 600       //超时时间  60s
    
    
    
    label linux
      menu label ^Install or upgrade an existing system
      menu default
      kernel vmlinuz
      append  initrd=initrd.img
    label text            //文本安装
      menu label Install system with ^basic video driver
      kernel vmlinuz
      append text initrd=initrd.img xdriver=vesa nomodeset
    label rescue        //救援模式
      menu label ^Rescue installed system
      kernel vmlinuz

    六、安装部署DHCP服务

    [root@www ~]# yum -y install dhcp
    [root@www ~]# cd /usr/share/doc/dhcp-4.1.1/
    [root@www dhcp-4.1.1]# cp dhcpd.conf.sample /etc/dhcp/dhcpd.conf 

    修改配置文件如下:

    只需在配置文件里添加网段声明即可;

    subnet 192.168.1.0 netmask 255.255.255.0 {
      range 192.168.1.10 192.168.1.20;
      option routers 192.168.1.10;
      filename "pxelinux.0";             //制定PXE引导程序名
      next-server 192.168.1.10;      //添加ftp服务器的
    }
    [root@www ~]# service dhcpd start

    这里为了方便测试,我们把防火墙规则清空;

    [root@www ~]# iptables -F
    [root@www ~]# iptables -L
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination 

    最后就是新建虚拟机进行测试了,此过程略过,需要注意的是把新建的虚拟机网卡选择在同一个网卡下;

    在这里,我们一起成长!!!

     

    在这里,我们一起成长!
  • 相关阅读:
    每日一篇文献:Robotic pick-and-place of novel objects in clutter with multi-affordance grasping and cross-domain image matching
    每日一篇文献:Intuitive Bare-Hand Teleoperation of a Robotic Manipulator Using Virtual Reality and Leap Motion
    每日一篇文献:Virtual Kinesthetic Teaching for Bimanual Telemanipulation
    HEBI Robotic Arm VR Teleoperation
    「iQuotient Case」AR device teleoperated robotic arm
    VR and Digital Twin Based Teleoperation of Robotic Arm
    HEBI Robotic Arm VR Teleoperation
    Human Robot Interaction
    Immersive Teleoperation Project
    机器人演示学习
  • 原文地址:https://www.cnblogs.com/yoo2767/p/5966267.html
Copyright © 2011-2022 走看看