http+tftp+pxe+kickstar自动化部署

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了http+tftp+pxe+kickstar自动化部署相关的知识,希望对你有一定的参考价值。

workstation虚机配置:

1.准备工作:

    ● 虚拟网络编辑器 ——> 去掉dhcp服务

    ● 修改主机名:workstation.example.com

    ● 关闭防火墙和selinux

    ● 创建目录

         #mkdir  -p /var/ftp/pub

    ● 挂载光盘

          #vim /etc/fstab

                /dev/sr0  /var/ftp/pub    iso9660    defaults    0 0

          #mount -a

          #df -Th(查看挂载)

    ● 配置网卡

           #vim /etc/sysconfig/network-scripts/ifcfg-eno16777736

             添加    IPADDR=192.168.83.100
                        NETMASK=255.255.255.0
                        GATEWAY=192.168.83.2
                        DNS1=8.8.8.8
              删除IPV6

              重启网络   systemctl restart network

              重启虚机   reboot

    ● 配置yum源

            #vim /etc/yum.repos.d/epel.repo

                [epel]
                name=epel
                baseurl=http://mirrors.aliyun.com/epel/7Server/x86_64
                enabled=1
                gpgcheck=0
2.安装dhcp服务

    ● 安装dhcp包          #yum -y install dhcp

     ● 编辑dhcp配置文件

            #vim /etc/dhcp/dhcpd.conf

                subnet 192.168.83.0 netmask 255.255.255.0 {
                    range dynamic-bootp 192.168.83.200 192.168.83.210;
                    option routers 192.168.83.2;
                    option domain-name-servers 8.8.8.8;
                    default-lease-time 21600;
                    max-lease-time 43200;
                    next-server 192.168.83.100;
                    filename "pxelinux.0";

     ● 重启dhcp服务 

3.安装tftp服务

    ● 装包

            #yum -y xinetd tftp-server tftp syslinux-tftpboot

     ● 编辑tftp

            #vim /etc/xinetd.d/tftp

                disable    = yes  (yes—>no)

     ● 复制启动所需文件

            #cd /var/ftp/pub/images/pxeboot/

            #ls

            #cp initrd.img /var/lib/tftpboot

            #cp vmlinuz /var/lib/tftpboot

4.配置default文件

     ● 创建目录 

            #mkdir /var/lib/tftpboot/pxelinux.cfg

     ● 编辑default文件

            #vim /var/lib/tftpboot/pxelinux.cfg/default

                default linux
                    promp 1
                    timeout 60
                    display boot.msg
                    label linux
                    kernel vmlinuz
                    append initrd=initrd.img text ks=http://192.168.83.100/ks/ks.cfg

     ● 重启xinetd服务

5.安装http

     ● 装httpd包

            #yum -y install httpd

     ● 重启http服务

            #systemctl start httpd

            #systemctl enable httpd

6.配置ks.cfg文件

      ● 创建目录

            #mkdir /var/www/html/ks

      ● 复制文件

            #cp anaconda-ks.cfg /var/www/html/ks/ks.cfg

      ● 修改ks.cfg文件

            修改系统认证信息   url --url=ftp://192.168.96.100/pub

                                                        install

        ● 修改ks.cfg权限  

                 #chmod +r /var/www/html/ks/ks.cfg

7.安装ftp服务

             # yum -y install vsftpd

            重启服务

                                    

               

创建server1、server2、database,启动网络引导

                     

        

以上是关于http+tftp+pxe+kickstar自动化部署的主要内容,如果未能解决你的问题,请参考以下文章

Kickstart

[亲测可用] PXE无人值守自动装机

自动化批量部署Linux系统(Kickstart+DHCP+NFS(http)+TFTP+PXE)

自动化运维之CentOS7下PXE+Kickstart+DHCP+TFTP+HTTP无人值守安装系统

利用DHCP,http,tftp,pxe实现纯自动化安装系统

PXE通过网络自动化安装系统