RHEL3远程安装
时间:2006-02-17 来源:wayyyay
如何在RHEL3.0下进行远程自动安装
随着越来越多的企业采用Linux作为其网络应用平台,产生了通过网络完成其客户机自动安装的需求。本文主要探讨在RHEL3.0下利用PXE协议完成自动安装的配置。PXE(Pre-boot Execution Environment)是由Intel设计的协议,它融入并扩展了DHCP来为PC提供网络引导的功能,目前市场的大多数PC都支持PXE。PXE协议很简单,网络内的一台客户机广播一则设置了PXE选项的“DHCP发现请求”,然后一台DHCP服务器用一个包含PXE选项的DHCP包来响应它,响应包里包含了引导文件的名字,客户机通过TFTP协议下载引导文件,然后执行这个引导文件。在本例中,客户机先下载Boot Loader pxegrub,然后根据pxegrub菜单的内容进行引导。
下面列出了简单的步骤:
安装tftp 服务器。注意修改文件"/etc/xinetd.d/tftp",将 disable 参数由yes改no(出于安全性的考虑,默认是关闭TFTP功能的)。
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
disable = no //打开TFTP功能
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
} 安装dhcp服务器,服务器的IP地址为192.168.0.254。
注意默认情况下配置文件/etc/dhcpd.conf没有包含在RPM包里,我们可以这样:
[root@lserver1 root]# cp /usr/share/doc/dhcp-3.0pl2/dhcpd.conf.sample /etc/dhcpd.conf
然后稍做修改,主要是定义子网的IP地址池,默认网关和DNS服务器的地址: ddns-update-style interim;
subnet 192.168.0.0 netmask 255.255.255.0 { //子网声明 # --- default gateway
option routers 192.168.0.254; //为DHCP客户设置的默认网关
option subnet-mask 255.255.255.0;//为DHCP客户设置的子网掩码 option domain-name "domain.org";//为DHCP客户设置DNS域
option domain-name-servers 192.168.0.254; //为DHCP客户设置DNS服务器地址
range dynamic-bootp 192.168.0.128 192.168.0.253; //设置地址池
default-lease-time 21600;
max-lease-time 43200;
filename "pxegrub"; // 引导文件的名字
}
编译pxegrub。
下载grub-0.95.tar.gz。 //可到链接http://www.gnu.org/software/grub下载
# tar xzvf grub-0.95.tar.gz //解压缩该包
# cd grub-0.95
# ./configure –help //查看能支持的客户端网卡类型
# ./configure --enable-diskless --enable-rtl8139 //这里我的客户端都是8139网卡
# make //编译
# cd stage2
# cp pxegrub /tftpboot/ //拷贝编译好的文件到tftp服务器主目录 4. 建立 /tftpboot/boot/grub目录,在其中写入文件menu.lst,即GRUB的菜单文件:
下面是一个范例:
default=0
tftpserver=192.168.0.254 //tftp服务器的IP地址,因为接下来要下载内核
timeout=10
title local-boot //使用本地grub的条目
rootnoverify (hd0)
chainloader +1
title RedHat-Enterprise-Linux-3-(rhel)-auto //使用远程自动安装的条目
kernel (nd)/boot/rhel/vmlinuz ramdisk_size=8192 ks=ftp://192.168.0.254/pub/rhel.cfg
initrd (nd)/boot/rhel/initrd.img
title RedHat-Enterprise-Linux-3-(rhel)-custom //使用有用户参与的远程安装条目
kernel (nd)/boot/rhel/vmlinuz ramdisk_size=8192
initrd (nd)/boot/rhel/initrd.img 根据上述menu.lst的需求,把文件initrd.img和vmlinuz放入/tftpboot/boot/rhel目录。
可以在RHEL3.0的第一张盘上找到上述文件。 配置FTP和NFS服务器,制作安装目录树。 如要支持自动安装,可用redhat-config-kickstart来配置需要的文件,将其存到对应的目录,这里对应的文件名是/var/ftp/pub/rhel.cfg。
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
disable = no //打开TFTP功能
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
} 安装dhcp服务器,服务器的IP地址为192.168.0.254。
注意默认情况下配置文件/etc/dhcpd.conf没有包含在RPM包里,我们可以这样:
[root@lserver1 root]# cp /usr/share/doc/dhcp-3.0pl2/dhcpd.conf.sample /etc/dhcpd.conf
然后稍做修改,主要是定义子网的IP地址池,默认网关和DNS服务器的地址: ddns-update-style interim;
subnet 192.168.0.0 netmask 255.255.255.0 { //子网声明 # --- default gateway
option routers 192.168.0.254; //为DHCP客户设置的默认网关
option subnet-mask 255.255.255.0;//为DHCP客户设置的子网掩码 option domain-name "domain.org";//为DHCP客户设置DNS域
option domain-name-servers 192.168.0.254; //为DHCP客户设置DNS服务器地址
range dynamic-bootp 192.168.0.128 192.168.0.253; //设置地址池
default-lease-time 21600;
max-lease-time 43200;
filename "pxegrub"; // 引导文件的名字
}
编译pxegrub。
下载grub-0.95.tar.gz。 //可到链接http://www.gnu.org/software/grub下载
# tar xzvf grub-0.95.tar.gz //解压缩该包
# cd grub-0.95
# ./configure –help //查看能支持的客户端网卡类型
# ./configure --enable-diskless --enable-rtl8139 //这里我的客户端都是8139网卡
# make //编译
# cd stage2
# cp pxegrub /tftpboot/ //拷贝编译好的文件到tftp服务器主目录 4. 建立 /tftpboot/boot/grub目录,在其中写入文件menu.lst,即GRUB的菜单文件:
下面是一个范例:
default=0
tftpserver=192.168.0.254 //tftp服务器的IP地址,因为接下来要下载内核
timeout=10
title local-boot //使用本地grub的条目
rootnoverify (hd0)
chainloader +1
title RedHat-Enterprise-Linux-3-(rhel)-auto //使用远程自动安装的条目
kernel (nd)/boot/rhel/vmlinuz ramdisk_size=8192 ks=ftp://192.168.0.254/pub/rhel.cfg
initrd (nd)/boot/rhel/initrd.img
title RedHat-Enterprise-Linux-3-(rhel)-custom //使用有用户参与的远程安装条目
kernel (nd)/boot/rhel/vmlinuz ramdisk_size=8192
initrd (nd)/boot/rhel/initrd.img 根据上述menu.lst的需求,把文件initrd.img和vmlinuz放入/tftpboot/boot/rhel目录。
可以在RHEL3.0的第一张盘上找到上述文件。 配置FTP和NFS服务器,制作安装目录树。 如要支持自动安装,可用redhat-config-kickstart来配置需要的文件,将其存到对应的目录,这里对应的文件名是/var/ftp/pub/rhel.cfg。
相关阅读 更多 +
排行榜 更多 +