Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1647312
  • 博文数量: 135
  • 博客积分: 2820
  • 博客等级: 少校
  • 技术积分: 2544
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-16 13:33
文章分类

全部博文(135)

文章存档

2015年(1)

2014年(8)

2013年(16)

2012年(43)

2011年(56)

2010年(11)

分类: LINUX

2012-05-04 21:10:02

dhcp+tftp+nfs+pxe+kickstart


一、环境

一台笔记本,安装的centos5.4 64位系统 ip:192.168.2.2
kicstart及其它服务都是安装在这台机器上,然后再用它去安装其它机器。

一张centos5.4 64位光盘(或者iso镜像)

二、安装及配置服务

前提准备:
要想配置kickstart ,首先要配置个本地yum源,要不然用system-config-kickstart时选不上包。
而且,yum 源的名字一定是[base],要不然会报:

Package selection is disabled due to problems downloading package information.

这要注意一下。
1) 先用光盘做个iso镜像
[man@web-nginx04 ~]$ dd if=/dev/cdrom of=/opt/CentOS.iso
[man@web-nginx04 ~]$ mount -o loop /opt/CentOS.ios /mnt

2)制做本地yum源
[man@web-nginx04 ~]$ more /etc/yum.repos.d/server.repo
[base]
name=base
baseurl=file:///mnt/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

(一)安装dhcp服务

[man@web-nginx04 ~]$ yum install dhcp dhcp-devel -y

[manzuo@web-nginx04 ~]$ cp /usr/share/doc/dhcp-3.05/dhcpd.conf.sample /etc/dhcpd.conf

把原来的模版覆盖.

我的配置如下:
[root@kickstart ~]# more /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
next-server 192.168.2.2;
filename "/pxelinux.0";


subnet 192.168.2.0 netmask 255.255.255.0 {

# --- default gateway
        option routers                  192.168.2.1;
        option subnet-mask              255.255.255.0;

#       option nis-domain               "domain.org";
#       option domain-name              "domain.org";
#       option domain-name-servers      192.168.2.1;

        option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#       option netbios-node-type 2;

        range dynamic-bootp 192.168.2.128 192.168.2.254;
        default-lease-time 10;
        max-lease-time 20;
#       next-server 192.168.2.2;
#       filename "pxelinux.0";

        # we want the nameserver to appear at a fixed address
#       host ns {
#               next-server marvin.redhat.com;
#               hardware ethernet 12:34:56:78:AB:CD;
#               fixed-address 207.175.42.254;
#       }
}

[root@kickstart ~]# /etc/init.d/dhcpd restart

(二)安装tftp
[root@kickstart ~]# yum install tftp* -y

[root@kickstart ~]# more /etc/xinetd.d/tftp
service tftp
{
        disable = no  #把原来的yes改成no
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

[root@kickstart ~]# /etc/init.d/xinetd restart


[root@kickstart ~]# cd /tftpboot
[root@kickstart ~]# cp /usr/lib/syslinux/pxelinux.0 ./
[root@kickstart ~]# cp /mnt/images/pxeboot/{vmlinuz,initrd.img}  ./
[root@kickstart ~]# cp /mnt/isolinux/*.msg ./
[root@kickstart ~]# mkdir -p pxelinux.cfg
[root@kickstart ~]# cp /mnt/isolinux/isolinux.cfg   pxelinux.cfg/default

[root@kickstart ~]# vi pxelinux.cfg/default
default linux
prompt 1
timeout 10
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
  kernel vmlinuz
  append ks=nfs:192.168.2.2:/centosinstall/ks.cfg ksdevice=eth0 initrd=initrd.img
label text
  kernel vmlinuz
  append initrd=initrd.img text
label ks
  kernel vmlinuz
  append ks initrd=initrd.img
label local
  localboot 1
label memtest86
  kernel memtest
  append -


(三)配置tftp

[root@kickstart ~]# mkdir -p /centosinstall
[root@kickstart ~]# cp -r /mnt/* /centosinstall

[root@kickstart ~]# vi /etc/exports
/centosinstall *(rw,sync)

[root@kickstart ~]# /etc/init.d/portmap restart
[root@kickstart ~]# /etc/init.d/nfs restart


(四)配置kickstart
[root@kickstart ~]# yum install *kickstart* -y
[root@kickstart ~]# system-config-kickstart
这时用这个程序配置kickstart,配置完成后在/root目录下生成个ks.cfg
[root@kickstart ~]# cp /root/ks.cfg /centosinstall/

[root@kickstart ~]# vi /centosinstall/ks.cfg
auth  --useshadow  --enablemd5
bootloader --location=mbr
key --skip   #这个是新加入的
zerombr
clearpart --all --initlabel
#graphical   #这个是原来的我注掉了,加上下面的text
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
logging --level=info
nfs --server=192.168.2.2 --dir=/centosinstall
network --bootproto=dhcp --device=eth0 --onboot=on --noipv6  #这个是我后加的,要不停在选择ipv4 ipv6 上。
rootpw --iscrypted $1$Pw9b.hdj$VyKT.yOk/e2k4pbDslKKc.

selinux --disabled
timezone --isUtc Asia/Shanghai
install
xconfig  --defaultdesktop=GNOME --depth=8 --resolution=640x480
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=12000
part / --bytes-per-inode=4096 --fstype="ext3" --size=50000
part /opt --bytes-per-inode=4096 --fstype="ext3" --grow --size=1

%packages
@development-libs
@base
@development-tools
@legacy-software-development
@legacy-software-support
@editors


这样,kickstart 配置就完成了。
把要安装的机器和这个kicstart 放在一台交换机上,把要安装的机器设置成网络启动就可以了。
写的比较粗糙,不知道我说没白了没有。
阅读(10224) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

zongg2013-10-14 09:03:13

dqwxf:你好,请教个问题呗。我在用kickstart对PC集群的节点进行网络安装RedHat5.4时,在安装过程中报错,大体信息是:no sufficient disk space.安装某某rpm包时需要124M的/usr空间。而实际上/usr有9GB的空间呢。是什么原因呢?

是不是你分区那有问题?

回复 | 举报

dqwxf2013-10-12 18:36:13

你好,请教个问题呗。我在用kickstart对PC集群的节点进行网络安装RedHat5.4时,在安装过程中报错,大体信息是:no sufficient disk space.安装某某rpm包时需要124M的/usr空间。而实际上/usr有9GB的空间呢。是什么原因呢?