Friday, August 9, 2019

PXE+HTTP 无盘安装linux系统

1.    建立服务器
    服务器需要安装DHCP、TFTP、WEB组件。
2.    配置服务器
    2.1    DHCP
        [root@WORKCENTRE ~]# touch /etc/dhcpd.conf
        [root@WORKCENTRE ~]# vi /etc/dhcpd.conf
              #--DHCP conf file begin
            ddns-update-style interim;
            ignore client-updates;

            subnet 192.168.1.0 netmask 255.255.255.0 {

            # --- default gateway
                option routers                  192.168.1.1;
                option subnet-mask              255.255.255.0;

            #    option nis-domain               "domain.org";
            #   option domain-name              "domain.org";
                option domain-name-servers      203.196.0.6;

                option time-offset              -18000; # Eastern Standard Time
            #       option ntp-servers              192.168.1.1;
            #       option netbios-name-servers     192.168.1.1;
            # --- Selects point-to-point node (default is hybrid). Don't change this unless
            # -- you understand Netbios very well
            #       option netbios-node-type 2;

            range dynamic-bootp 192.168.1.228 192.168.1.236;
            default-lease-time 21600;
            max-lease-time 43200;

            # we want the nameserver to appear at a fixed address
            host WORK-LAPTOP {
                        next-server 192.168.1.88;        //tftp服务器的地址
                        hardware ethernet 00 : 16 : D3 : 3B : 77 :63;
                        fixed-address 192.168.1.90;
                        filename "pxelinux.0";
                    }
            }
            
            #--DHCP conf file end
            
    2.2 TFTP
        [root@WORKCENTRE ~]# mkdir /tftpboot
        [root@WORKCENTRE ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
        [root@WORKCENTRE ~]# mkdir /tftpboot/pxelinux.cfg/
        [root@WORKCENTRE ~]# mount -o loop /FC-6-x86_64-disc1.iso /mnt/
        [root@WORKCENTRE ~]# cp /mnt/images/pxeboot/initrd.img /tftpboot/
        [root@WORKCENTRE ~]# cp /mnt/images/pxeboot/vmlinuz /tftpboot/
        [root@WORKCENTRE ~]# touch /tftpboot/pxelinux.cfg/default
        [root@WORKCENTRE ~]# vi /tftpboot/pxelinux.cfg/default

             #--default file begin               
                default linux
            
             label linux
                  kernel vmlinuz
                  append initrd=initrd.img
                #--default file end

3.    拷贝安装文件
        [root@WORKCENTRE ~]# mkdir /var/www/html/FC6
        [root@WORKCENTRE ~]# mount -o loop /FC-6-x86_64-disc1.iso /mnt/  
        [root@WORKCENTRE ~]# cp -r /mnt/images/ /var/www/html/FC6/
        [root@WORKCENTRE ~]# cp -r /mnt/repodata/ /var/www/html/FC6/
        [root@WORKCENTRE ~]# cp -r /mnt/Fedora/ /var/www/html/FC6/
        [root@WORKCENTRE ~]# umount /mnt/
        [root@WORKCENTRE ~]# mount -o loop /FC-6-x86_64-disc2.iso /mnt/
        [root@WORKCENTRE ~]# cp -r /mnt/Fedora/ /var/www/html/FC6/
        [root@WORKCENTRE ~]# umount /mnt/
        [root@WORKCENTRE ~]# mount -o loop /FC-6-x86_64-disc3.iso /mnt/
        [root@WORKCENTRE ~]# cp -r /mnt/Fedora/ /var/www/html/FC6/
        [root@WORKCENTRE ~]# umount /mnt/
        [root@WORKCENTRE ~]# mount -o loop /FC-6-x86_64-disc4.iso /mnt/
        [root@WORKCENTRE ~]# cp -r /mnt/Fedora/ /var/www/html/FC6/
        [root@WORKCENTRE ~]# umount /mnt/
        [root@WORKCENTRE ~]# mount -o loop /FC-6-x86_64-disc5.iso /mnt/
        [root@WORKCENTRE ~]# cp -r /mnt/Fedora/ /var/www/html/FC6/
        [root@WORKCENTRE ~]# umount /mnt/
        [root@WORKCENTRE ~]# mount -o loop /FC-6-x86_64-disc6.iso /mnt/
        [root@WORKCENTRE ~]# cp -r /mnt/Fedora/ /var/www/html/FC6/

4.   启动服务
        [root@WORKCENTRE ~]# /etc/init.d/dhcpd start
        [root@WORKCENTRE ~]# /etc/init.d/httpd start
        [root@WORKCENTRE ~]# chkconfig tftp on

5.    开始安装
        打开笔记本,F12选择从网络引导。
       安装文件选择HTTP。输入网址和路径。

       其他和光盘安装一样。  

No comments:

Post a Comment