PXE+Kickstart 安裝Centos 6.4

1. 安裝好一臺主機(CentOS 6.4),在上面安裝和配置(IPADDR: 192.168.1.2)
   yum -y install tftp //給需要安裝系統的機器提供虛擬系統文件
   yum -y install tftp-server  //tftp的啓動是不需要daemon的,需要xinetd
   yum -y install vsftpd  //提供安裝鏡像
   yum -y install dhcp //分發IP
2. 配置以上安裝服務
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
}

vim /etc/dhcp/dhcpd.conf

ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
 range 192.168.1.3 192.168.1.50;
 option routers 192.168.1.2;
 filename "/pxelinux.0";
 next-server 192.168.1.2;
 default-lease-time 600;
 max-lease-time 7200;
}

3. 建立安裝系統需要的計算機引導文件
   mkdir /tftpboot  
   mkdir /tftpboot/pxelinux.cfg  
   cp /your_path/pxelinux.0 /tftpboot/    //如果不能找到,需要安裝syslinux
   cp /your_path_of_OS_p_w_picpath/isolinux.cfg /tftpboot/pxelinux.cfg/default  //需要掛載Centos 鏡像
   cp //your_path_of_OS_p_w_picpath/p_w_picpaths/pxeboot/initrd.img /tftpboot/  
   cp /media/CentOS-6.0-netinstall/p_w_picpaths/pxeboot/vmlinuz /tftpboot/  
   chmod u+w /tftpboot/pxelinux.cfg/default
vim /tftpboot/pxelinux.cfg/default

default linux
timeout 600
display boot.msg
label linux
 menu label ^Install or upgrade an existing system
 menu default
 kernel vmlinuz
 append initrd=initrd.img ks=ftp://192.168.1.2/pub/ks.cfg
label vesa
 menu label Install system with ^basic video driver
 kernel vmlinuz
 append initrd=initrd.img xdriver=vesa nomodeset
label rescue
 menu label ^Rescue installed system
 kernel vmlinuz
 append initrd=initrd.img rescue
label local
 menu label Boot from ^local drive
 localboot 0xffff
label memtest86
 menu label ^Memory test
 kernel memtest
 append -

啓動服務
service vsftpd start  
service xinetd restart  
service dhcpd restart

4. 製作Kickstart文件(在主機的/root 目錄下有anaconda-ks.cfg,可以基於此文件修改),並命名爲ks.cfg,放置在/var/ftp/pub目錄下。  //此文件需要配置成other可讀

auth  --useshadow  --enablemd5
bootloader --location=mbr
zerombr
clearpart --all --initlabel
text
firewall --disabled
firstboot --disable
selinux --disabled
keyboard us
lang en_US
logging --level=info
url --url=ftp://192.168.1.2/pub
network --bootproto=static --ip 192.168.1.7 --netmask 255.255.255.0 --gateway 192.168.1.2 --nameserver 192.168.1.2 --hostname compute01.hpc --device=eth0 --onboot=on
reboot
rootpw --iscrypted $1$DWk4vKDK$r5rJS12L5XW1G8CdTdDvm0
timezone --isUtc Asia/Shanghai
install
part /boot --fstype=ext4 --size=200
part / --fstype=ext4 --size=102400
part swap --size=2048
part /data --fstype=ext4 --grow --size=200
%packages
@core
@development
@server-policy
%end

5. PXE啓動需要安裝機器,進入自動化安裝
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章