首页 > 代码库 > CentOS7.0-PXE批量部署

CentOS7.0-PXE批量部署


CentOS7.0-Kickstart无人值守安装

 

方法:FTP+TFTP+DHCP+Kickstart+PXE

PXE服务器:CentOS7.0-192.168.25.1

 

1.搭建yum仓库

[root@max ~]# vim /etc/yum.repos.d/serverl.repo

[base]

name=server

baseurl=file:///mnt

gnabled=1

gpgcheck=0

[root@max ~]# mount /dev/cdrom /mnt

 

2.配置ftp:

[root@max ~]# yum install vsftpd  –y

[root@max ~]# systemctl restart vsftpd.service ;systemctl enable vsftpd.service

 

3.配置tftp:

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

[root@max ~]# vim /etc/xinetd.d/tftp

service tftp

{

        socket_type             = dgram

        protocol                = udp

        wait                    = yes

        user                    = root

        server                  = /usr/sbin/in.tftpd

        server_args             = -s /tftpboot

        disable                 = no

        per_source              = 11

        cps                     = 100 2

        flags                   = IPv4

}

[root@max ~]# systemctl restart xinetd.service ; systemctl restart tftp.service ; systemctl enable tftp.service   

 

4.安装dhcp,修改配置文件及开启服务:

[root@max ~]# yum install dhcp  –y

[root@max ~]# cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak

[root@max ~]# cp /usr/share/doc/dhcp*/dhcpd.conf.example dhcpd.conf

[root@max ~]# vim /etc/dhcp/dhcpd.conf

vim /etc/dhcp/dhcpd.conf

subnet 192.168.25.0 netmask 255.255.255.0 {

        range 192.168.25.100 192.168.25.200;

        next-server 192.168.25.1;

        filename "pxelinux.0";

}

[root@max ~]# systemctl restart dhcpd ;systemctl enable dhcpd

 

准备工作完成,我们开始配置Kickstart

[root@max ~]# mkdir /tftpboot

[root@max ~]# mkdir /tftpboot/pxelinux.cfg

[root@max ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/

----如果找不到syslinux目录,需要安装包syslinux

[root@max ~]# cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

[root@max ~]# cp /mnt/images/pxeboot/initrd.img /tftpboot/

[root@max ~]# cp /mnt/images/pxeboot/vmlinuz /tftpboot/

[root@max ~]# chmod 644 /tftpboot/pxelinux.cfg/default

[root@max ~]# vim /tftpboot/pxelinux.cfg/default

 

技术分享

技术分享


[root@max ~]# yum install system-config-kickstart.noarch –y

[root@max ~]# system-config-kickstart

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

[root@max ~]#cp ks.cfg  /var/ftp

重新挂载CentOS7.0安装光盘到/var/ftp/pub目录下,开始执行另一台机器的无人值守安装

[root@max ~]# umount /dev/cdrom     //原来挂载到/mnt下的

[root@max ~]# mount /dev/cdrom /var/ftp/pub

[root@max ~]# iptables -F

[root@max ~]# setenforce 0

[root@max ~]# systemctl stop firewall


CentOS7.0-PXE批量部署