标签:kickstart
随着公司业务不断增加,经常需要采购新服务器,并要求安装Linux系统,并且要求Linux版本要一致,方便以后的维护和管理,每次人工安装linux系统会浪费掉更多时间,如果我们有办法能节省一次一次的时间岂不更好呢?
大中型互联网公司一次采购服务器上百台,如果采用人工手动一台一台的安装,一个人得搞坏N张光盘,得多少个加班加点才能完成这项”艰巨”的任务呢,我们可以看到全人工来完成这样的工作太浪费人力了,有没有自动化安装平台呢,通过一台已存在的系统然后克隆或者复制到新的服务器呢。Kickstart可以毫不费力的完成这项工作。
PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file transfer protocol)协议下载一个启动软件包到本机内存中执行。
要使用kickstart安装平台,包括的完整架构为:Kickstart+DHCP+NFS+TFTP+PXE,从架构可以看出,大致需要安装的服务,例如dhcp、tftp、nfs、kickstart/pxe等。
[root@192_168_77_199 ~]# cat /etc/issue
CentOS release 6.6 (Final)
Kernel \r on an \m
[root@192_168_77_199 ~]# uname -r
2.6.32-504.el6.x86_64
yum install -y dhcp* tftp* nfs* syslinux -y
首先配置tftp服务:vi /etc/xinetd.d/tftp,只需要把disable = yes改成disable = no即可。
ln -s /var/lib/tftpboot/ / 链接到根目录下面
cd /tftpboot/; cp /usr/share/syslinux/pxelinux.0 . ; cp /mnt/images/pxeboot/{vmlinuz,initrd.img} . ; mkdir pxelinux.cfg ; cp /mnt/isolinux/isolinux.cfg ./default
在default中添加:label centos6.6
kernel vmlinuz
append ks=nfs:192.168.77.199:/data/centos/ks.cfg ksdevice=eth0 initrd=initrd.img
mkdir -p /data/centos ; cd /data/centos/ 共享centos目录vi /etc/exports添加:/data/centos *(rw,sync) ;nohup cp /mnt/* . -a &后台把光盘文件copy到共享目录centos下
配置ks.cfg cd /data/centos vi /etc/ks.cfg添加以下配置内容:ks.cfg也可以通过复制root目录下面的anaconda-ks.cfg进行修改
# Kickstart file automatically generated by anaconda. #version=DEVEL install text nfs --server=192.168.77.199 --dir=/data/centos/ lang zh_CN.UTF-8 keyboard us network --onboot no --device eth0 --bootproto dhcp --noipv6 rootpw 123456 firewall --disabled authconfig --enableshadow --passalgo=sha512 selinux --disabled reboot timezone Asia/Shanghai bootloader --location=mbr --driveorder=sda --append="rhgb quiet" zerombr # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work #clearpart --none clearpart --all --initlabel --drives=sda part /boot --fstype ext4 --size=200 part swap --size=2000 part / --fstype ext4 --size=10000 part /data --fstype ext4 --size=1 --grow #clearpart --all --initlabel #part /boot --fstype=ext4 --size=200 #part / --fstype=ext4 --size=10000 #part swap --size=2000 #part /data --fstype=ext4 --size=1 --grow #part /data --fstype=ext4 --grow --size=200 #repo --name="CentOS" --baseurl=cdrom:sr0 --cost=100 %packages @chinese-support @core @development @eclipse @emacs @server-policy @tex @workstation-policy ant rpmdevtools jpackage-utils rpmlint %end
配置dhcpd服务:
ddns-update-style interim; ignore client-updates; next-server 192.168.77.199; filename "pxelinux.0"; allow booting; allow bootp; subnet 192.168.77.0 netmask 255.255.255.0 { # --- default gateway option routers 192.168.77.1; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.77.100 192.168.77.200; host ns { hardware ethernet 00:1a:a0:2b:38:81; fixed-address 192.168.77.101;} }
service xinetd restart
service nfs restart
service dhcpd restart重启服务之后就可以自动安装了但是需要手动输入centos6.6
自动安装不需要输入任何东西:ks.cfg文件配置不用改变只需改一下default里面的配置如下:
default vesamenu.c32
#prompt 1
default ks
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.6!
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 ks
# kernel vmlinuz
# append ks=http://192.168.77.199/ks.cfg initrd=initrd.img
label ks
kernel vmlinuz
append ks=nfs:192.168.77.199:/data/centos/ks.cfg ksdevice=eth0 initrd=initrd.img
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img
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 -
以上就是全部配置安装详细请参考:
http://www.xue163.com/332/1654/3327690.html
本文出自 “毛毛鸭” 博客,请务必保留此出处http://woshitieren.blog.51cto.com/2466034/1673196
标签:kickstart
原文地址:http://woshitieren.blog.51cto.com/2466034/1673196