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 放在一台交换机上,把要安装的机器设置成网络启动就可以了。
写的比较粗糙,不知道我说没白了没有。
阅读(10253) | 评论(2) | 转发(0) |