My favorites | Sign in
Project Logo
                
Search
for
Updated Feb 26, 2008 by michaelbibby
RHEL_PXE_Installation_Server  
在 RHEL 上配置用于 PXE 网络安装 RHEL 的中心服务器

About the author

Summary

tftp

安装以下两个包:

一个服务器端,一个客户端程序。

tftp 服务由 xinetd 服务管理。编辑 '''/etc/xinetd.d/tftp''' 文件,将 '''disable = yes''' 改为:

disable = no

重启 xinetd:

# /etc/init.d/xinetd restart
# chkconfig --level 35 xinetd on

DHCP

使用 ISC 的 dhcpd 软件:

# rpm -ivh --aid dhcp-3.0.1.rpm
# cp -f /usr/share/doc/dhcp-3.0.1/dhcpd.conf.example /etc/dhcpd.conf

修改 /etc/dhcpd.conf 文件,指定 IP 地址等信息。

在 '''/etc/dhcpd.conf''' 中增加 tftp-server 需要推送给客户端的启动文件:

filename "pxelinux.0";

因为 tftp 的默认目录是 /tftpboot,所以文件的绝对路径就是:

/tftpboot/pxelinux.0"

也可以指定为别的路径。

另外需要指定 next-server 参数,告诉客户端在获取到 pxelinux.0 文件之后去哪里获取其余的启动文件:

next-server 192.168.1.1;

PXE

安装 syslinux

使用 syslinux 提供 PXE 安装(RedHat Enterprise Linux默认已安装)。

可以直接下载 RPM 包。

配置

/tftpboot/pxelinux.0

安装好 syslinux 以后,将 pxelinux.0 这个文件复制到 '''/tftpboot''' 目录:

# rpm -ql syslinux | grep 'pxelinux.0'
/usr/share/syslinux/pxelinux.0

# cp /usr/share/syslinux/pxelinux.0 /tftpboot

用于网络安装的内核文件

将 RedHat 安装光盘目录中的 '''images/pxeboot/{vmlinuz,initrd.img}''' 文件复制到某个安装目录,比如:'''/tftpboot/install/rhel4.4-inst/''':

# mkdir -p /tftpboot/install/rhel4.4-inst/
# cp /media/cdrom/images/pxeboot/{vmlinuz,initrd.img} /tftpboot/install/rhel4.4-inst/

/tftpboot/pxelinux.cfg/

该目录用于存放客户端的配置文件。

创建目录:

# mkdir /tftpboot/pxelinux.cfg/

将光盘中的 '''isolinux/isolinux.cfg''' 文件复制为 '''/tftpboot/pxelinux.cfg/default''',以下内容根据原文件略加修改并做了注释(注:该文件中的空行和以 '''#''' 开头的行都将被忽略):

# 默认启动的是 'label linux' 中标记的内核
default linux

# 显示 'boot: ' 提示符。
# 为 '0' 时则不提示,将会直接启动 'default' 参数中指定的内容。
prompt 1

# 在用户输入之前的超时时间,单位为 1/10 秒。
timeout 600

# 显示某个文件的内容,注意文件的路径。默认是在 /tftpboot 目录下。
# 也可以指定位类似 'install/rhel4.4-inst/boot.msg' 这样的,路径+文件名。
display boot.msg

# 按下 'F1' 这样的键后显示的文件。注意路径。默认是 /tftpboot。
# 注:syslinux 官方网站上说目前只能使用 F1-F10。 
F1 install/rhel4.4-inst/boot.msg
F2 install/rhel4.4-inst/options.msg
#...
F10 install/rhel4.4-inst/snake.msg

# 'label' 指定你在 'boot:' 提示符下输入的关键字。
# 比如:
#     boot: linux[ENTER]
# 这个会启动 'label linux' 下标记的 kernel 和 initrd.img 文件。
# 这里还定义了其它几个关键字:
#     boot: text
#     boot: ks
#
# kernel 参数指定要启动的内核。同样要注意路径,默认是 /tftpboot 目录。
# append 指定追加给内核的参数,能够在 gurb 里使用的追加给内核的参数,在这里也
#        都可以使用。
label linux
  kernel install/rhel4.4-inst/vmlinuz
  append initrd=install/rhel4.4-inst/initrd.img ramdisk_size=8192

label text
  kernel vmlinuz
  append initrd=install/rhel4.4-inst/initrd.img text ramdisk_size=8192
label expert
  kernel vmlinuz
  append expert initrd=install/rhel4.4-inst/initrd.img ramdisk_size=8192

# 使用 kickstart 安装。
# 可以在 ks 参数后直接指定 kickstart 文件的位置。
# 关于 kickstart 的更多参数和设置,请参考各版本的 RHEL 的 Installation Guide:
# * http://www.redhat.com/docs/manuals/enterprise/
#     Installation Guide --> Advanced Installation and Deployment

label ks basic
  kernel install/rhel4.4-inst/vmlinuz
  append ks=ftp://192.168.10.251/install/rhel4.4_basic.cfg initrd=install/rhel4.4-inst/initrd.img ramdisk_size=8192

label lowres
  kernel vmlinuz
  append initrd=install/rhel4.4-inst/initrd.img lowres ramdisk_size=8192
label local
  localboot 1
label memtest86
  kernel memtest
  append -

比如:网卡 MAC 地址是 '''88:99:AA:BB:CC:DD''',针对这台主机的配置文件就是:

01-88-99-aa-bb-cc-dd

以 '''01''' 开头,用 '''-'''(dash) 分隔,用小写字母表示 MAC 地址。

还可以用16进制数来表示 IP 地址,比如,IP 地址为 192.0.2.91,转换为十六进制数就是:

C000025B

针对 IP 为 192.0.2.91 这个 IP 的主机的配置文件,文件名就是 '''C000025B'''。

注意:pxelinux 搜索的文件的顺序是:

/tftpboot/pxelinux.cfg/01-88-99-aa-bb-cc-dd
/tftpboot/pxelinux.cfg/C000025B
/tftpboot/pxelinux.cfg/C000025
/tftpboot/pxelinux.cfg/C00002
/tftpboot/pxelinux.cfg/C0000
/tftpboot/pxelinux.cfg/C000
/tftpboot/pxelinux.cfg/C00
/tftpboot/pxelinux.cfg/C0
/tftpboot/pxelinux.cfg/C
/tftpboot/pxelinux.cfg/default

注:可以使用 windows 上附件里的计算机来计算十六进制与10进制之间的转换。

/tftpboot/pxelinux.cfg/boot.msg

这是在 '''/tftpboot/pxelinux.cfg/default''' 文件中指定要显示的文件(DISPLAY)。 这是一个普通的文本文件。但是还可以有一些高级的定义,比如显示一个背景,清屏,字体颜色等。

具体信息请参考:http://syslinux.zytor.com/faq.php#format

http/ftp/nfs

这里可以任选一种服务用于提供安装系统所需要的介质。这里以 http 服务为例。

这样客户端就可以选择 http 方式来安装系统了。

服务器的信息填写:

NFS

使用 NFS 服务来提供安装介质,不需要将 ISO 挂载,只需要直接放到共享目录下即可。RHEL 安装程序会自动将 ISO 挂载到本地进行安装。


Sign in to add a comment
Hosted by Google Code