远程安装LINUX,使用PXE,DHCP
时间:2006-10-31 来源:hubble.king
参考网址:http://syslinux.zytor.com/pxe.php
安装以前参考了许多的前辈文章,但是按照文章操作后发觉有很多都是不能成功的。
下面就是我实际操作中涉及到的主要步骤及相关配置。
系统环境:Redhat AS4
需要软件:
nfs、dhcp、tftp服务端,以及AS4的安装源。
1。首先把全部的四张盘上的文件复制到 /var/ftp/AS4 中
2。编辑 /etc/exports文件实现nfs共享
[root@localhost linux-install]# cat /etc/exports
/var/ftp/AS4 192.168.6.0/24(ro,no_root_squash)
3。从其它安装好AS4的机器中制作kickstart.cfg文件,复制到 /var/ftp/AS4中并改名为 ks.cfg,下面的ks.cfg文件是全部安装linux组件。 [root@localhost linux-install]# cat /var/ftp/AS4/ks.cfg
#Generated by Kickstart Configurator
#platform=x86, AMD64, or Intel EM64T #System language
lang en_US
#Language modules to install
langsupport zh_CN en_SG --default=en_US
#System keyboard
keyboard us
#System mouse
mouse
#Sytem timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $1$1.bKm6Vy$Fj.q/dO1f0k2Zy3JhEsZy1
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use NFS installation Media
nfs --server=192.168.6.38 --dir=/var/ftp/AS4
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --linux --initlabel
#Disk partitioning information
autopart
#System authorization infomation
auth --useshadow --enablemd5
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled
#XWindows configuration information
xconfig --depth=16 --resolution=1024x768 --defaultdesktop=GNOME --startxonboot
#Package install information
%packages
@ everything
@ chinese-support
kernel
lvm2
grub
kernel-devel
e2fsprogs %post
4。配置/etc/dhcpd.conf文件,默认dhcpd.conf文件是没有的,需要自己创建。 [root@localhost pxelinux.cfg]# cat /etc/dhcpd.conf
ddns-update-style ad-hoc; #--------tftp-------------
ignore client-updates;
allow booting;
allow bootp;
#---------------------
subnet 192.168.6.0 netmask 255.255.255.0
{
range 192.168.6.160 192.168.6.190;
range 192.168.6.200 192.168.6.210;
#---------tftp---------------
#range dynamic-bootp 192.168.6.191 192.168.6.195
#----------------------------
default-lease-time 999605800;
max-lease-time 604800;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.6.255;
option routers 192.168.6.1;
option domain-name-servers 192.168.0.3,172.18.3.31;
option domain-name "lidoo.com";
next-server 192.168.6.38; #TFTP server filename "linux-install/pxelinux.0"; #the file of pxelinux loader
}
5。tftp服务基本没有什么配置文件需要改动,只需准备相关的启动文件。 准备启动镜像:AS4系统安装好tftp服务后默认会建立 /tftpboot/linux-install 文件夹,并且已经给我们了一个可以加载linux启动镜像的引导模块 pxelinux.0 下面从刚才复制到系统中的文件中复制/var/ftp/AS4/images/pxeboot/* 到 /tftp/linux-install/as4 中 cp /var/ftp/AS4/images/pxeboot/* /tftp/linux-install/as4/ 然后建立文件夹 makdir /tftp/linux-install/pxelinux.cfg cp /var/ftp/AS4/isolinux/isolinux.cfg /tftp/linux-install/pxelinux.cfg/pxelinux.cfg/default 并修改一下,让它可以支持自动安装 我这里的default文件内容如下: [root@localhost linux-install]# cat /tftpboot/linux-install/pxelinux.cfg/default
default local
prompt 1
timeout 200
display msgs/boot.msg
label ks
kernel as4/vmlinuz
append ks initrd=as4/initrd.img ramdisk_size=8192
label ks1
kernel as4/vmlinuz
append ks=nfs:192.168.6.38:/var/ftp/AS4/ks.cfg ksdevice=eth0 initrd=as4/initrd.img ramdisk_size=8192
label ks2
kernel as4/vmlinuz
append ks=nfs:192.168.6.38:/var/ftp/AS4/ks.cfg ksdevice=eth1 initrd=as4/initrd.img ramdisk_size=8192
label local
localboot 1
label memtest86
kernel as4/memtest
append - 6。上面全部好了以后,启动dhcp,tftp,nfs服务 chkconfig --level 35 dhcpd on chkconfig --level 35 tftp on chkconfig --level 35 nfs on service nfs restart service dhcpd restart service xinetd restart 7。下面设置客户机以支持pxe网络启动,然后就可以安装了。 附件:启动网络安装的相关配置文件 [root@localhost /]# tar ztvf tftp.tar.gz
drwxr-xr-x root/root 0 2006-10-31 16:11:26 tftpboot/linux-install/msgs/
-rw-r--r-- root/root 668 2006-10-31 14:02:48 tftpboot/linux-install/msgs/expert.msg
-rw-r--r-- root/root 545 2006-10-31 14:02:48 tftpboot/linux-install/msgs/snake.msg
-rw-r--r-- root/root 871 2006-10-31 14:02:48 tftpboot/linux-install/msgs/general.msg
-rw-r--r-- root/root 860 2006-10-31 14:02:48 tftpboot/linux-install/msgs/param.msg
-rw-r--r-- root/root 677 2006-10-31 16:11:26 tftpboot/linux-install/msgs/boot.msg
-rw-r--r-- root/root 530 2006-10-31 14:02:48 tftpboot/linux-install/msgs/rescue.msg
drwxr-xr-x root/root 0 2006-10-31 16:07:13 tftpboot/linux-install/as4/
-rw-r--r-- root/root 1433988 2006-10-31 14:53:59 tftpboot/linux-install/as4/vmlinuz
-rw-r--r-- root/root 81860 2006-10-31 15:13:04 tftpboot/linux-install/as4/memtest
-rw-r--r-- root/root 3092868 2006-10-31 14:53:59 tftpboot/linux-install/as4/initrd.img
drwxr-xr-x root/root 0 2006-10-31 16:11:09 tftpboot/linux-install/pxelinux.cfg/
-rw-r--r-- root/root 482 2006-10-31 16:11:09 tftpboot/linux-install/pxelinux.cfg/default
-rw-r--r-- root/root 763 2006-10-31 15:32:12 tftpboot/linux-install/pxelinux.cfg/rh73
-rw-r--r-- root/root 735 2006-10-31 15:18:12 tftpboot/linux-install/pxelinux.cfg/as4
-rw-r--r-- root/root 11822 2006-10-31 14:02:48 tftpboot/linux-install/pxelinux.0
-rw-r--r-- root/root 2495 2006-10-31 14:43:49 etc/dhcpd.conf
注:启动后会看到相关提示的。
ks1 回车 使用第一块网卡启动自动安装
ks1 回车 使用第二块网卡启动自动安装
local 回车 不安装从本地系统启动
memtest 回车 测试系统内存。
/var/ftp/AS4 192.168.6.0/24(ro,no_root_squash)
3。从其它安装好AS4的机器中制作kickstart.cfg文件,复制到 /var/ftp/AS4中并改名为 ks.cfg,下面的ks.cfg文件是全部安装linux组件。 [root@localhost linux-install]# cat /var/ftp/AS4/ks.cfg
#Generated by Kickstart Configurator
#platform=x86, AMD64, or Intel EM64T #System language
lang en_US
#Language modules to install
langsupport zh_CN en_SG --default=en_US
#System keyboard
keyboard us
#System mouse
mouse
#Sytem timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $1$1.bKm6Vy$Fj.q/dO1f0k2Zy3JhEsZy1
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use NFS installation Media
nfs --server=192.168.6.38 --dir=/var/ftp/AS4
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --linux --initlabel
#Disk partitioning information
autopart
#System authorization infomation
auth --useshadow --enablemd5
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled
#XWindows configuration information
xconfig --depth=16 --resolution=1024x768 --defaultdesktop=GNOME --startxonboot
#Package install information
%packages
@ everything
@ chinese-support
kernel
lvm2
grub
kernel-devel
e2fsprogs %post
4。配置/etc/dhcpd.conf文件,默认dhcpd.conf文件是没有的,需要自己创建。 [root@localhost pxelinux.cfg]# cat /etc/dhcpd.conf
ddns-update-style ad-hoc; #--------tftp-------------
ignore client-updates;
allow booting;
allow bootp;
#---------------------
subnet 192.168.6.0 netmask 255.255.255.0
{
range 192.168.6.160 192.168.6.190;
range 192.168.6.200 192.168.6.210;
#---------tftp---------------
#range dynamic-bootp 192.168.6.191 192.168.6.195
#----------------------------
default-lease-time 999605800;
max-lease-time 604800;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.6.255;
option routers 192.168.6.1;
option domain-name-servers 192.168.0.3,172.18.3.31;
option domain-name "lidoo.com";
next-server 192.168.6.38; #TFTP server filename "linux-install/pxelinux.0"; #the file of pxelinux loader
}
5。tftp服务基本没有什么配置文件需要改动,只需准备相关的启动文件。 准备启动镜像:AS4系统安装好tftp服务后默认会建立 /tftpboot/linux-install 文件夹,并且已经给我们了一个可以加载linux启动镜像的引导模块 pxelinux.0 下面从刚才复制到系统中的文件中复制/var/ftp/AS4/images/pxeboot/* 到 /tftp/linux-install/as4 中 cp /var/ftp/AS4/images/pxeboot/* /tftp/linux-install/as4/ 然后建立文件夹 makdir /tftp/linux-install/pxelinux.cfg cp /var/ftp/AS4/isolinux/isolinux.cfg /tftp/linux-install/pxelinux.cfg/pxelinux.cfg/default 并修改一下,让它可以支持自动安装 我这里的default文件内容如下: [root@localhost linux-install]# cat /tftpboot/linux-install/pxelinux.cfg/default
default local
prompt 1
timeout 200
display msgs/boot.msg
label ks
kernel as4/vmlinuz
append ks initrd=as4/initrd.img ramdisk_size=8192
label ks1
kernel as4/vmlinuz
append ks=nfs:192.168.6.38:/var/ftp/AS4/ks.cfg ksdevice=eth0 initrd=as4/initrd.img ramdisk_size=8192
label ks2
kernel as4/vmlinuz
append ks=nfs:192.168.6.38:/var/ftp/AS4/ks.cfg ksdevice=eth1 initrd=as4/initrd.img ramdisk_size=8192
label local
localboot 1
label memtest86
kernel as4/memtest
append - 6。上面全部好了以后,启动dhcp,tftp,nfs服务 chkconfig --level 35 dhcpd on chkconfig --level 35 tftp on chkconfig --level 35 nfs on service nfs restart service dhcpd restart service xinetd restart 7。下面设置客户机以支持pxe网络启动,然后就可以安装了。 附件:启动网络安装的相关配置文件 [root@localhost /]# tar ztvf tftp.tar.gz
drwxr-xr-x root/root 0 2006-10-31 16:11:26 tftpboot/linux-install/msgs/
-rw-r--r-- root/root 668 2006-10-31 14:02:48 tftpboot/linux-install/msgs/expert.msg
-rw-r--r-- root/root 545 2006-10-31 14:02:48 tftpboot/linux-install/msgs/snake.msg
-rw-r--r-- root/root 871 2006-10-31 14:02:48 tftpboot/linux-install/msgs/general.msg
-rw-r--r-- root/root 860 2006-10-31 14:02:48 tftpboot/linux-install/msgs/param.msg
-rw-r--r-- root/root 677 2006-10-31 16:11:26 tftpboot/linux-install/msgs/boot.msg
-rw-r--r-- root/root 530 2006-10-31 14:02:48 tftpboot/linux-install/msgs/rescue.msg
drwxr-xr-x root/root 0 2006-10-31 16:07:13 tftpboot/linux-install/as4/
-rw-r--r-- root/root 1433988 2006-10-31 14:53:59 tftpboot/linux-install/as4/vmlinuz
-rw-r--r-- root/root 81860 2006-10-31 15:13:04 tftpboot/linux-install/as4/memtest
-rw-r--r-- root/root 3092868 2006-10-31 14:53:59 tftpboot/linux-install/as4/initrd.img
drwxr-xr-x root/root 0 2006-10-31 16:11:09 tftpboot/linux-install/pxelinux.cfg/
-rw-r--r-- root/root 482 2006-10-31 16:11:09 tftpboot/linux-install/pxelinux.cfg/default
-rw-r--r-- root/root 763 2006-10-31 15:32:12 tftpboot/linux-install/pxelinux.cfg/rh73
-rw-r--r-- root/root 735 2006-10-31 15:18:12 tftpboot/linux-install/pxelinux.cfg/as4
-rw-r--r-- root/root 11822 2006-10-31 14:02:48 tftpboot/linux-install/pxelinux.0
-rw-r--r-- root/root 2495 2006-10-31 14:43:49 etc/dhcpd.conf
|
相关阅读 更多 +