PXE+DHCP+TFTP+NFS+Kickstart網路自動安裝配置簡化版

tonykorn97發表於2008-04-08

DHCP,NFS,TFTP使用同一臺伺服器,IP為172.25.1.114


一、配置DHCP服務
安裝dhpc
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 "redhat5x86/pxelinux.0";
next-server 172.25.1.114;
}
subnet 172.25.0.0 netmask 255.255.0.0 {
option routers 172.25.0.254;
option subnet-mask 255.255.0.0;
# option nis-domain "";
# option domain-name "";
# option domain-name-servers 202.96.134.133;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 172.25.1.130 172.25.1.140;
default-lease-time 21600;
max-lease-time 43200;

host linux {
hardware ethernet 00:1E:C9:3A:37:48;
fixed-address 172.25.1.130;
}
host linux2 {
hardware ethernet 00:1E:C9:3A:34:E8;
fixed-address 172.25.1.131;
}
}


======================================================================

二、配置TFTP
安裝
chkconfig tftp on
service xinetd restart
====================================================================
三、啟動檔案配置
[root@localhost tftpboot]# mkdir redhat5x86
[root@localhost tftpboot]# mount -o loop /root/redhat5.x64.iso /mnt
[root@localhost tftpboot]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/redhat5x86/
[root@localhost tftpboot]# mkdir /tftpboot/redhat5x86/pxelinux.cfg
[root@localhost tftpboot]# cp /mnt/isolinux/isolinux.cfg /tftpboot/redhat5x86/pxelinux.cfg/default
[root@localhost tftpboot]# cp /mnt/images/pxeboot/initrd.img /tftpboot/redhat5x86/
[root@localhost tftpboot]# cp /mnt/images/pxeboot/vmlinuz /tftpboot/redhat5x86/
[root@localhost tftpboot]#

default的預設資訊為:
[root@localhost tftpboot]# cat /tftpboot/redhat5x86/pxelinux.cfg/default
default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append initrd=initrd.img
label text
kernel vmlinuz
append initrd=initrd.img text
label ks
kernel vmlinuz
append ks initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -

[root@localhost tftpboot]#

修改為:
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 linux memtest86
kernel memtest
append -
label linux autoinstall
kernel vmlinuz
append ks= initrd=initrd.img devfs=nomount ramdisk_size=16384 nofb


[root@localhost redhat5x86]# cp /mnt/isolinux/*.msg /tftpboot/redhat5x86/
[root@localhost redhat5x86]# cat /tftpboot/redhat5x86/boot.msg
splash.lss

- To install or upgrade in graphical mode, press the 0107 key.

- To install or upgrade in text mode, type: 01linux text 07.

- Use the function keys listed below for more information.

0f[F1-Main] [F2-Options] [F3-General] [F4-Kernel] [F5-Rescue]07
[root@localhost redhat5x86]#

修改boot.msg檔案為:

^L
^Xsplash.lss
- To boot Operation System locally, press the ^O01^O07 key.
- To install or upgrade in graphical mode, type: ^O01linux ^O07 key.
- To install or upgrade in text mode, type: ^O01linux text ^O07.
- To auto install or upgrade, type: ^O01linux autoinstall ^O07.
- Use the function keys listed below for more information.
^O0f[F1-Main] [F2-Options] [F3-General] [F4-Kernel] [F5-Rescue]^O07

===============================================================
四、配置NFS服務

[root@localhost redhat5x86]# cat /etc/exports
/export *(ro,sync)
/export/ks *(rw,sync)
[root@localhost redhat5x86]#


[root@localhost /]# mkdir /export
[root@localhost /]# mkdir /export/ks
[root@localhost /]# mv /root/*.iso /export/
[root@localhost /]# cp /root/anaconda-ks.cfg /export/ks/ks.cfg
[root@localhost /]# chmod 644 /export/ks/ks.cfg
[root@localhost /]#

===============================================================
五、重啟服務

service dhcpd restart
service xinetd restart
service nfs restart
===============================================================
六、裝置客戶端

客戶端設定PXE啟動啟動後輸入linux autoinstall

問題:
輸入linux autoinstall一直不能執行,

輸入:
linux ks= 可以執行.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-245856/,如需轉載,請註明出處,否則將追究法律責任。

相關文章