在 RHEL 上配置用于 PXE 网络安装 RHEL 的中心服务器
http://code.google.com/p/redhatsolution/wiki/RHEL_PXE_Installation_Server
[@more@]tftp 服务由 xinetd 服务管理。编辑 '''/etc/xinetd.d/tftp''' 文件,将 '''disable = yes''' 改为:
disable = no
# /etc/init.d/xinetd restart# chkconfig --level 35 xinetd on
# 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;
使用 syslinux 提供 PXE 安装(RedHat Enterprise Linux默认已安装)。
可以直接下载 RPM 包。
安装好 syslinux 以后,将 pxelinux.0 这个文件复制到 '''/tftpboot''' 目录:
# rpm -ql syslinux | grep 'pxelinux.0'/usr/share/syslinux/pxelinux.0
# cp /usr/share/syslinux/pxelinux.0 /tftpboot
# mkdir -p /tftpboot/install/rhel4.4-inst/# cp /media/cdrom/images/pxeboot/{vmlinuz,initrd.img} /tftpboot/install/rhel4.4-inst/
# mkdir /tftpboot/pxelinux.cfg/
# 默认启动的是 '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 -
boot: linux secure
比如:网卡 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'''。
/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进制之间的转换。
具体信息请参考:http://syslinux.zytor.com/faq.php#format
这里可以任选一种服务用于提供安装系统所需要的介质。这里以 http 服务为例。
# /etc/init.d/httpd restart
# mkdir -p /var/www/html/rhel/5/5.1/server/i386/
# mount -o loop rhel-5.1-server-i386-dvd.iso /var/www/html/rhel/5/5.1/server/i386/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9697/viewspace-1030698/ ,如需转载,请注明出处,否则将追究法律责任。