Kickstart 是RedHat 公司开发的自动安装部署工具,kickstart批量部署工具利用主板PXE模式加载DHCP服务器上的pxelinux.0文件来加载引导内核启动安装程序,安装ks.cfg预定义的动作完成自动安装任务。
以CentOS6.4为例: 服务端需要如下服务
pxelinux.0 pxe专用启动引导文件,/usr/share/syslinux 目录中找到,直接存放在TFTP要目录即可(也可在/etc/dhcpd.conf 指定)
客户端需要
取出安装光盘或同步网络上的源来制作好Yum源(ftp访问方式),创建一个基于 Comps.xml 的软件仓库
mkdir -pv /var/ftp/pub/images cd /var/ftp/pub/images wget http://mirrors.163.com/centos/6.4/os/x86_64/images/install.img
mkdir -pv /tftpboot/pxelinux.cfg cp /usr/share/syslinux/pxelinux.0 /tftpboot/ cd /tftpboot/ wget http://mirrors.163.com/centos/6.4/os/x86_64/images/pxeboot/initrd.img wget http://mirrors.163.com/centos/6.4/os/x86_64/images/pxeboot/vmlinuz创建 /tftpboot/pxelinux.cfg/default 文件
default pxeboot #prompt 1 timeout 6 label pxeboot menu AutoInstall CentOS 6.4 With Pxeboot kernel vmlinuz append initrd=initrd.img ks=ftp://192.168.1.1/pub/ks.cfg
service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /tftpboot #开机必需的程序路径(根据的tftpboot路径更改) disable = no #把这边的yes改为no per_source = 11 cps = 100 2 flags = IPv4 }
添加相应配置 /etc/dhcpd.conf
option domain-name "regulusos.org"; option domain-name-servers 8.8.8.8; default-lease-time 600; max-lease-time 7200; ddns-update-style none; authoritative; subnet 192.168.1.0 netmask 255.255.255.0 { filename "pxelinux.0"; next-server 192.168.1.1; range dynamic-bootp 192.168.1.100 192.168.1.200; option routers 192.168.1.1; option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; }
将准备好的kickstart配置文件复制到指定位置:(我们在/tftpboot/pxelinux.cfg/default文件中曾设置ks=ftp://192.168.1.1/pub/ks.cfg) 按照之前的预设,将文件复制到FTP服务的根目录:
cp ks.cfg /var/ftp/ /var/ftp/pub/ 目录是VSFTP服务的根目录
启动需要部署的服务器,让PXE从tftp自动引导安装过程,如果一且顺利你现在可以喝一杯咖啡,或者出去活动活动筋骨再来看看结果!
文件中 root 密码是 qwer1234
firewall --disabled install url --url="ftp://192.168.1.1/pub" rootpw --iscrypted $1$qsdgeWL8$95GRTNbk3Ni7XerD2JZZ71 auth --useshadow --passalgo=sha512 text keyboard us lang en_US selinux --enforcing logging --level=info timezone Asia/Harbin network --bootproto=bootp --device=eth0 --onboot=on zerombr yes bootloader --location=mbr --driveorder=sda clearpart --all --initlabel part / --fstype=ext4 --size=6000 part swap --grow --size=1024 repo --name="CentOS" --baseurl=ftp://192.168.1.1/pub --cost=100 reboot %packages --nobase @core %end