天天看点

kickstart安装配置

     Kickstart自动化安装平台

随着公司业务不断增加,经常需要采购新服务器,并要求安装Linux系统,并且要求Linux版本要一致,方便以后的维护和管理,每次人工安装linux系统会浪费掉更多时间,如果我们有办法能节省一次一次的时间岂不更好呢?

大中型互联网公司一次采购服务器上百台,如果采用人工手动一台一台的安装,一个人得搞坏N张光盘,得多少个加班加点才能完成这项”艰巨”的任务呢,我们可以看到全人工来完成这样的工作太浪费人力了,有没有自动化安装平台呢,通过一台已存在的系统然后克隆或者复制到新的服务器呢。Kickstart可以毫不费力的完成这项工作。

要使用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

<a href="http://s3.51cto.com/wyfs02/M00/6F/8D/wKioL1Wf7hTBbzB4AAGs6-ods9E741.jpg" target="_blank"></a>

mkdir -p /data/centos  ;  cd /data/centos/ 共享centos目录vi /etc/exports添加:/data/centos    *(rw,sync) ;nohup cp /mnt/* . -a &amp;后台把光盘文件copy到共享目录centos下

配置ks.cfg   cd /data/centos   vi /etc/ks.cfg添加以下配置内容:ks.cfg也可以通过复制root目录下面的anaconda-ks.cfg进行修改

<code># Kickstart file automatically generated by anaconda.</code>

<code>#version=DEVEL</code>

<code>install</code>

<code>text</code>

<code>nfs --server=192.168.77.199 --</code><code>dir</code><code>=</code><code>/data/centos/</code>

<code>lang zh_CN.UTF-8</code>

<code>keyboard us</code>

<code>network --onboot no --device eth0 --bootproto dhcp --noipv6</code>

<code>rootpw  123456</code>

<code>firewall --disabled</code>

<code>authconfig --enableshadow --passalgo=sha512</code>

<code>selinux --disabled</code>

<code>reboot</code>

<code>timezone Asia</code><code>/Shanghai</code>

<code>bootloader --location=mbr --driveorder=sda --append=</code><code>"rhgb quiet"</code>

<code>zerombr</code>

<code># The following is the partition information you requested</code>

<code># Note that any partitions you deleted are not expressed</code>

<code># here so unless you clear all partitions first, this is</code>

<code># not guaranteed to work</code>

<code>#clearpart --none</code>

<code>clearpart --all --initlabel --drives=sda</code>

<code>part </code><code>/boot</code> <code>--fstype ext4 --size=200</code>

<code>part swap --size=2000</code>

<code>part / --fstype ext4 --size=10000</code>

<code>part </code><code>/data</code> <code>--fstype ext4 --size=1 --grow</code>

<code>#clearpart --all --initlabel</code>

<code>#part /boot --fstype=ext4 --size=200</code>

<code>#part / --fstype=ext4 --size=10000</code>

<code>#part swap --size=2000</code>

<code>#part /data --fstype=ext4 --size=1 --grow</code>

<code>#part /data --fstype=ext4 --grow --size=200</code>

<code>#repo --name="CentOS"  --baseurl=cdrom:sr0 --cost=100</code>

<code>%packages</code>

<code>@chinese-support</code>

<code>@core</code>

<code>@development</code>

<code>@eclipse</code>

<code>@emacs</code>

<code>@server-policy</code>

<code>@tex</code>

<code>@workstation-policy</code>

<code>ant</code>

<code>rpmdevtools</code>

<code>jpackage-utils</code>

<code>rpmlint</code>

<code>%end</code>

配置dhcpd服务:

<code>ddns-update-style interim;</code>

<code>ignore client-updates;</code>

<code>next-server 192.168.77.199;</code>

<code>filename </code><code>"pxelinux.0"</code><code>;</code>

<code>allow booting;</code>

<code>allow bootp;</code>

<code>subnet 192.168.77.0 netmask 255.255.255.0 {</code>

<code># --- default gateway</code>

<code>option routers          192.168.77.1;</code>

<code>option subnet-mask      255.255.255.0;</code>

<code>range dynamic-bootp 192.168.77.100 192.168.77.200;</code>

<code>host ns {</code>

<code>hardware ethernet  00:1a:a0:2b:38:81;</code>

<code>fixed-address 192.168.77.101;}</code>

<code>}</code>

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

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

  append initrd=initrd.img xdriver=vesa nomodeset

label rescue

  menu label ^Rescue installed system

  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

本文转自 Anonymous123 51CTO博客,原文链接:http://blog.51cto.com/woshitieren/1673196

继续阅读