且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

kickstart部署centos6.2 x86_64

更新时间:2022-10-13 19:03:51

本人近期一直在练习kickstart自动部署centos,整理了一篇经过n次实践的文档分享一下!

centos6.2 with kickstart网络启动自动安装centos6.2 x64(KickStart+PXE+httpd+DHCP+TFTP)
参考文章
http://blog.csdn.net/silent1/article/details/7635646

进入正题:
kickstart服务器,操作系统是centos6.2 x64
yum install dhcp tftp* xinetd httpd syslinux

vim /etc/xinetd.d/tftp
disable=no

将/var/lib/tftpboot链接到/tftpboot
ln -s /var/lib/tftpboot /tftpboot


建立安装源
挂载centos盘
mount -o loop -t iso9660 centos.iso /misc/cd
复制安装centos所需启动菜单和内核、ramdisk镜像文件到tftp
cp /usr/share/syslinux/pxelinux.0 /usr/share/syslinux/vesamenu.c32 /misc/cd/images/pxeboot/vmlinuz /misc/cd/images/pxeboot/initrd.img /misc/cd/isolinux/*.msg /misc/cd/isolinux/memtest /misc/cd/isolinux/splash.jpg /tftpboot
建立pxelinux.cfg目录
mkdir -p /tftpboot/pxelinux.cfg
制造启动菜单
cp /misc/cd/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
修改内容
vim /tftpboot/pxelinux.cfg/default

# /tftpboot/pxelinux.cfg/default(/misc/cd/isolinux/isolinux.cfg)
default vesamenu.c32
#prompt 1
timeout 30
display boot.msg
menu background splash.jpg
menu title Come on,let's get it started!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000

label CentOS Linux 6.2 x64
   menu label ^Install CentOS 6.2 x64
   menu default
   kernel vmlinuz
   append ks=http://192.168.44.250/ks/centos6/ks.cfg initrd=initrd.img ksdevice=eth0
label CentOS Linux 6.2 x64 vesa mode
     menu label Install system with ^basic video driver
     kernel vmlinuz
     append ks=http://192.168.44.250/ks/centos6/ks.cfg initrd=initrd.img ksdevice=eth0 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 -


在apache的发布目录中放上安装源
cp -a /misc/cd/* /var/www/html/ks/centos6

配置dhcp
vim /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
next-server 192.168.44.250;
filename "pxelinux.0";
allow booting;
allow bootp;
subnet 192.168.44.0 netmask 255.255.255.0 {
# — default gateway
option routers 192.168.44.1;
option subnet-mask 255.255.255.0;
# option nis-domain “domain.org”;
option domain-name "admaster.com.cn";
option domain-name-servers 202.106.195.68;
option time-offset -18000; # Eastern Standard Time
range 192.168.44.100 192.168.44.120;
}


制造ks.cfg
vim /var/www/html/ks/centos6/ks.cfg
# centos6/ks.cfg
firewall --disabled
install
url --url http://192.168.44.250/ks/centos6
text
firstboot --disable
rootpw admaster
auth --useshadow --enablemd5
lang en_US
keyboard us
selinux --disabled
logging --level=info
reboot
timezone --isUtc Asia/Shanghai
network --bootproto=dhcp --device=eth0 --onboot=on
zerombr
bootloader --location=mbr
clearpart --all --initlabel
part swap --fstype="swap" --size=4096
part /boot --fstype="ext4" --size=200
part / --fstype="ext4" --size=1 --grow
%packages
openssh-server
openssh
vim

如果想把图形界面也一起装上
在上面vim下面再加三行
@ X Window System
@ Desktop
@ Desktop Platform


启动各项服务
/etc/init.d/dhcpd restart;/etc/init.d/xinetd restart;/etc/init.d/httpd restart



本文转自 朱科强 51CTO博客,原文链接:http://blog.51cto.com/zhukeqiang/1374124,如需转载请自行联系原作者