Chinaunix

标题: RHEL 5中PXE+DHCP+TFTP+NFS+Kickstart网络安装配置 [打印本页]

作者: johncan    时间: 2008-07-15 03:41
标题: RHEL 5中PXE+DHCP+TFTP+NFS+Kickstart网络安装配置

                                参考文章:http://space.itpub.net/?uid-312079-action-viewspace-itemid-245856
内容基本上都是以上文章的,只根据实际操作做了简单修改,还加入了一些说明
好文章:
基于网络的 Red Hat 无人值守安装
环境:
1、Vmware Server 1.0.6
2、客体操作系统,也就是提供远程安装服务的服务器端为RHEL 5.0,IP为192.168.1.100,同时也提供DHCP,NFS,TFTP服务,提供centos5.0给客户端机器安装
一、配置DHCP服务
1、安装dhcp
# rpm -ivh dhcp-3.0.5-3.el5.i386.rpm
2、修改dhcpd.conf
# vi /etc/dhcpd.conf
修改或添加内容为以下:
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;

class "pxeclients"{
    match if substring(option vendor-class-identifier,0,9) = "PXEClient";
    filename "centos5/pxelinux.0";
    next-server 192.168.1.100;
    }
subnet 192.168.1.0 netmask 255.255.255.0 {
    option routers 192.168.1.1;
    option subnet-mask 255.255.255.0;
    # option nis-domain "www.tonykorn.com";
    # option domain-name "www.tonykorn.com";
    # option domain-name-servers 202.96.134.133;
    option time-offset -18000; # Eastern Standard Time
    range dynamic-bootp 192.168.1.130 192.168.1.140;
    default-lease-time 21600;
    max-lease-time 43200;

host oracle1 {
    hardware ethernet 00:0C:29:79:43:0F;
    fixed-address 192.168.1.132;
    }
}
相关说明
1、filename "centos5/pxelinux.0"
本例中pxelinux.0文件的位置为/tftpboot/centos5/pxelinux.0,所以此处需要根据实际情况进行相应修改
2、next-server 192.168.1.100;
此处为提供DHCP服务的服务器的IP,本例中为192.168.1.100
3、option routers 192.168.1.1;
此处为网关的IP地址
4、range dynamic-bootp 192.168.1.130 192.168.1.140;
分配给客户端的IP地址范围,本例中为130-140号段
5、host oracle1 {
    hardware ethernet 00:0C:29:79:43:0F;
    fixed-address 192.168.1.132;
    }
此处为静态分配IP,当DHCP服务器检测到客户端的MAC地址为00:0C:29:79:43:0F时,服务器就分配192.168.1.132给它,并将他的主机名设置为oracle1
此处设置并非必须
二、配置TFTP
1、安装
# rpm -ivh tftp-0.42-3.1.i386.rpm
# rpm -ivh tftp-server-0.42-3.1.i386.rpm
2、启动tftp服务
# chkconfig tftp on
# service xinetd restart
三、配置NFS
# mkdir /export
# mkdir /export/ks
# vi /etc/exports
添加以下内容:
/export *(ro,sync)
/export/ks *(rw,sync)
# service portmap start
# service nfs start
四、启动文件配置
# mkdir /tftpboot/centos5
# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/centos5/
# mkdir /tftpboot/centos5/pxelinux.cfg
# mount -o loop /export/centos5.iso /mnt/cdrom
# cp /mnt/cdrom/isolinux/isolinux.cfg /tftpboot/centos5/pxelinux.cfg/default
# cp /mnt/cdrom/images/pxeboot/initrd.img /tftpboot/centos5/
# cp /mnt/cdrom/images/pxeboot/vmlinuz /tftpboot/centos5/
# vi /tftpboot/centos5/pxelinux.cfg/default
修改为以下内容,其中nfs服务器IP地址192.168.1.100需根据实际情况作修改:
default local
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label local
localboot 0
label linux install
  kernel vmlinuz
  append initrd=initrd.img
label linux text
  kernel vmlinuz
  append initrd=initrd.img text
label linux ks
  kernel vmlinuz
  append ks initrd=initrd.img
label memtest86
  kernel memtest
  append -
label linux autoinstall
kernel vmlinuz
append ks=nfs:192.168.1.100:/export/ks/ks.cfg initrd=initrd.img devfs=nomount ramdisk_size=16384 nofb
# cp /mnt/cdrom/isolinux/*.msg /tftpboot/centos5/
# cp /mnt/cdrom/isolinux/splash.lss /tftpboot/centos5
splash.lss文件为要求输入运行方式(boot:)的命令菜单上的图形
# vi /tftpboot/centos5/boot.msg
在Use行前添加一行,此行目的是提示操作人员应如何输入命令来进行自动安装或升级,内容为
-  To auto install or upgrade , type: ^O0blinux autoinstall ^O07.
# service xinetd restart
# service nfs restart
# service dhcpd restart
好了,现在可以新建一个虚拟机,然后将启动方式设置为网络启动,可以看到客户端获取IP地址,加载相关文件,现在可以实现远程开启安装过程,但还不是自动安装,因为系统启动时没有加载到ks.cfg的配置,明天再继续试验。
还是没有成功,贴一些资料:
ks.cfg 文件由三个部份皆组成:

               
               
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/17993/showart_1081865.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2