HomeSun
可愛的小學生

文章: 12
|
 |
« 於: 2003-10-03 10:26 » |
|
PXE 安裝
所需的環境,DHCP server,PXE server以及具有 PXEboot 功能的 client . Step1 : DHCP Server 的設定 DHCP Server 的設定檔至少要包含以下的設定值 #vi /etc/dhcpd.conf ---------------------------------------------------------------------------------------- ddns-update-style interim; ignore client-updates; subnet 192.10.0.0 netmask 255.255.255.0 { range dynamic-bootp 192.10.0.10 192.10.0.15; } ---------------------------------------------------------------------------------------- DHCP,PXE server 預設是不能架在同一台上,需修改 /etc/pxe.conf 檔才能使用在同一台機器上 Step2:tftp,mtftp daemon 在架設 PXE server 時還需同時啟動 tftp or mtftp daemon ,mtftp 是具有 Multicast 功能的 tftp(為何只能用 tftp or mtftp ,因為 PXE ROM 只具備 UDP 的功能,所以只能使用以 UDP 為通信協定的 tftp or mtftp) I.啟動 tftp chkconfig tftp on II.啟動 mtftp 因為系統並沒有為 mtftp 寫啟動設定檔 /etc/xinetd.d/mtftp ,所以我們將修改 /etc/xinetd.d/tftp 檔 #cp /etc/xinetd.d/tftp /etc/xinetd.d/mtftp #vi /etc/xinetd.d/mtftp -------------------------------------------------------------------------------------------- # 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 mtftp { disable = no socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.mtftpd server_args = -s /tftpboot per_source = 11 cps = 100 2 }
-------------------------------------------------------------------------------------------- 只有service mtftp, server = /usr/sbin/in.mtftpd 要修改 III.啟動 mtftp chkconfig mtftp on #chkconfig --list | grep tftp mtftp: on tftp: on
Step3: PXE Server 的設定 I.安裝 PXE Server 套件 #rpm -ivh pxe-...........rpm II.PXE server 的設定檔 /etc/pxe.conf 預設的設定檔就可以使用了,但是我還要安裝其他版本的 RedHat Linux ,所以還是要修改一下設定檔 #vi /etc/pxe.conf ------------------------------------------------------------------------------------- # Prompt to display on the user screen # format of this entry: timeout,<STRING> [Prompt] 10,Press F8 to view menu ...
# Boot server types supported [Service_Types] 0,BStrap 13,linux-install-rh73 14,linux-install-rh80 15,linux-install-rh90
# Menu string that will be displayed on the client screen # after F8 is pressed. [X86PC/UNDI/MENU] 0,Local Boot 13,RedHat 7.3 Install Linux 14,RedHat 8.0 Install Linux 15.RedHat 9.0 Install Linux
# Image file name for Linux install boot server type # format : [X86PC/UNDI/linux-install-rh73/ImageFile_Name] 0 2 linux [X86PC/UNDI/linux-install-rh80/ImageFile_Name] 0 2 linux [X86PC/UNDI/linux-install-rh90/ImageFile_Name] 0 2 linux [X86PC/UNDI/BStrap/ImageFile_Name] 0 0 bstrap ------------------------------------------------------------------------------------- 說明: I.首先要新增的是 PXE 開機時的選單 [X86PC/UNDI/MENU] 0,Local Boot 13,RedHat 7.3 Install Linux 14,RedHat 8.0 Install Linux 15.RedHat 9.0 Install Linux II.因為 RedHat Linux 的不同版本所需的開機 kernel,initrd imag 也不同,所以要為每一版 RedHat Linux 建立不同的資料夾 # Boot server types supported [Service_Types] 0,BStrap 13,linux-install-rh73 14,linux-install-rh80 15,linux-install-rh90 其中的數字必須要和 boot menu ([X86PC/UNDI/MENU] 所指定的)相同,至於目錄下還可以做不同設定,所以還要加上以下的設定. [X86PC/UNDI/linux-install-rh73/ImageFile_Name] 0 2 linux [X86PC/UNDI/linux-install-rh80/ImageFile_Name] 0 2 linux [X86PC/UNDI/linux-install-rh90/ImageFile_Name] 0 2 linux 路徑部分還要和 Service_Types 相配合(ex:13,linux-install-rh73 時路徑名稱需為 X86PC/UNDI/linux-install-rh73/ImageFile_Name) 而以上的 0,2,linux 所代表的是 PXE 安裝要用到 bootstrap + kernel + initrd 檔 還有其他的組合為 0,0,linux 所代表的是 PXE 安裝要用到 bootstrap 檔 0,1,linux 所代表的是 PXE 安裝要用到 bootstrap + kernel檔 III.重新啟動 PXE #chkconfig pxe on #service pxe restart or # /etc/init.d/pxe restart IV.確定 /etc/services 中 PXE,mtftp 的相對應 port 已經開啟 #vi /etc/services ---------------------------------------------------------------------------- mtftp 1759/udp pxe 67/udp pxe 4011/udp ---------------------------------------------------------------------------- 這些 port number 都是 PXE Boot 所必須的 #route add -host 255.255.255.255.255 eth0 我們可以把這一行加到 /etc/rc.local 中,使每次開機時都能執行. V.設定 PXE 安裝所需的光碟內容 我需要 RedHat 90,RedHat 80,RedHat 7.3 等不同板本的 RedHat Linux(以下用 RedHat 9.0為範例) 所以要先建立目錄來安裝 RedHat 90 目錄,並將三片光碟的內容放在此目錄 #mkdir /var/ftp/rh90 放第一片光碟 #mount /mnt/cdrom #cp -r /mnt/cdrom/* /var/ftp/rh90 複製第一片光碟內容 #umount /mnt/cdrom 放第二片光碟 #mount /mnt/cdrom #cp -r /mnt/cdrom/* /var/ftp/rh90 複製第二片光碟內容 #umount /mnt/cdrom 放第三片光碟 #mount /mnt/cdrom #cp -r /mnt/cdrom/* /var/ftp/rh90 複製第三片光碟內容 其他 RedHat 8.0 ,RedHat7.3 方法皆同 VI.PXE 開機時所需的 kernel,initrd imag PXE 開機時會依據 /etc/pxe.conf 設定去存取不同的目錄來得到所許的開機 kernel,initrd imag I.RedHat 73 所需的 kernel,initrd imag RedHat 73 使用PXE 開機時所需的 kernel,initrd imag 皆儲存在第一片光碟(我們之前已經將光碟內容複製 /var/ftp/rh73 目錄下,所以從 /var/ftp/rh73/images/pxeboot/ 目錄找即可) 先建立 /tftpboot/X86PC/UNDI/linux-install-rh73 目錄 #cp /var/ftp/rh73/images/pxeboot/vmlinux /tftpboot/X86PC/UNDI/linux-install-rh73/linux.1 note: linux.1 是 linux kernel #cp /var/ftp/rh73/images/pxeboot/initrd.img /tftpboot/X86PC/UNDI/linux-install-rh73/linux.2 note: linux.2 是 linux installation initrd image note: 還要記得將 linux.0 複製到 /tftpboot/X86PC/UNDI/linux-install-rh73 目錄下 I.RedHat 80 所需的 kernel,initrd imag RedHat 80 使用PXE 開機時所需的 kernel,initrd imag 皆儲存在第一片光碟(我們之前已經將光碟內容複製 /var/ftp/rh80 目錄下,所以從 /var/ftp/rh80/images/pxeboot/ 目錄找即可) 先建立 /tftpboot/X86PC/UNDI/linux-install-rh80 目錄 #cp /var/ftp/rh80/images/pxeboot/vmlinux /tftpboot/X86PC/UNDI/linux-install-rh80/linux.1 note: linux.1 是 linux kernel #cp /var/ftp/rh80/images/pxeboot/initrd.img /tftpboot/X86PC/UNDI/linux-install-rh80/linux.2 note: linux.2 是 linux installation initrd image note: 還要記得將 linux.0 複製到 /tftpboot/X86PC/UNDI/linux-install-rh80 目錄下 I.RedHat 90 所需的 kernel,initrd imag RedHat 90 使用PXE 開機時所需的 kernel,initrd imag 皆儲存在第一片光碟(我們之前已經將光碟內容複製 /var/ftp/rh90 目錄下,所以從 /var/ftp/rh90/images/pxeboot/ 目錄找即可) 先建立 /tftpboot/X86PC/UNDI/linux-install-rh90 目錄 #cp /var/ftp/rh90/images/pxeboot/vmlinux /tftpboot/X86PC/UNDI/linux-install-rh90/linux.1 note: linux.1 是 linux kernel #cp /var/ftp/rh90/images/pxeboot/initrd.img /tftpboot/X86PC/UNDI/linux-install-rh90/linux.2 note: linux.2 是 linux installation initrd image note: 還要記得將 linux.0 複製到 /tftpboot/X86PC/UNDI/linux-install-rh90 目錄下 Step4: 安裝 I.FTP 安裝 光碟的內容皆存放在 /var/ftp 目錄下,所以用 FTP 安裝時只要指定 /var/ftp 下的子目錄即可(ex:用 FTP 安裝只要指定 /rh73 or /rh80 or /rh90 即可). II.NFS 安裝 若採取 NFS 的安裝法時要分享安裝目錄 #vi /etc/exports ---------------------------------------------------------------- /var/ftp/rh90 192.10.0.*(ro) /var/ftp/rh80 192.10.0.*(ro) /var/ftp/rh73 192.10.0.*(ro) ----------------------------------------------------------------
III.HTTP 安裝 若採取 HTTP 的安裝法時要修改 /etc/httpd/conf/httpd.conf #vi /etc/httpd/conf/http.conf ----------------------------------------------------------------- Document Root "/var/ftp" ----------------------------------------------------------------- 將 Document Root 改為 "/var/ftp" 即可 Step5: PXE Clients 安裝 啟動網路卡的 PXE 功能並將他的開機順序列為最高 .......................................... 接下來的安裝就如同光碟安裝一般 Step6: 加入其它 Linux Distribution 至 PXE Server SuSe 8.2 powered by UnitedLinux I.同樣的將 SuSe 8.2 五片光碟內容複製到 NFS Server 中所建立的目錄下 #mkdir /var/ftp/SuSE82 放第一片光碟 #mount /mnt/cdrom #cp -r /mnt/cdrom/* /var/ftp/SuSE82 複製第一片光碟內容 #umount /mnt/cdrom 放第二片光碟 #mount /mnt/cdrom #cp -r /mnt/cdrom/* /var/ftp/SuSE82 複製第二片光碟內容 #umount /mnt/cdrom 放第三片光碟 #mount /mnt/cdrom #cp -r /mnt/cdrom/* /var/ftp/SuSE82 複製第三片光碟內容 放第四片光碟 #mount /mnt/cdrom #cp -r /mnt/cdrom/* /var/ftp/SuSE82 複製第四片光碟內容 放第五片光碟 #mount /mnt/cdrom #cp -r /mnt/cdrom/* /var/ftp/SuSE82 複製第五片光碟內容 II.並將 SuSe 所在目錄設為分享 #vi /etc/exports ---------------------------------------------------------------- /var/ftp/rh90 192.10.0.*(ro) /var/ftp/rh80 192.10.0.*(ro) /var/ftp/rh73 192.10.0.*(ro) /var/ftp/SuSE82 192.10.0.*(ro) ---------------------------------------------------------------- III.而SuSE 8.2 的 kernel,initrd 存放在第一片光碟中 boot 目錄下的 bootdisk (我們之前已經將光碟內容複製 /var/ftp/SuSE82 目錄下,所以從 /var/ftp/SuSE82/boot/ 目錄找即可) #cd /var/ftp/SuSE82/boot #mount -o loop bootdisk /mnt/floppy #cp /mnt/floppy/linux /tftpboot/X86PC/UNDI/linux-install-su82/linux.1 #umount /mnt/floppy 因為 bootdisk 為 image file 所以要用 mount 加 -o loop 參數才能看到 image file 的內容, linux 是 linux kernel ,接下來要找到 initrd 它是存在 /boot/modules1 中 #mount - o loop modules1 /mnt/floppy #cp /mnt/floppy/initrd /tftpboot/X86PC/UNDI/linux-install-su82/linux.2 #umount /mnt/floppy 這個 initrd 只包括 USB,SCSI 的 module 所以在安裝時會找不到網路卡而無法用網路安裝,所以要製作網路 module 的磁片(SuSe 8.2 有提供),名稱為 /boot/modules3(它也是 image file 所以要用 dd 來做磁片) #dd if=/boot/modules3 of=/dev/fd0 note: 還要記得將 linux.0 複製到 /tftpboot/X86PC/UNDI/linux-install-SuSE82 目錄下
IV. 修改 PXE server 的設定檔 /etc/pxe.conf # Boot server types supported [Service_Types] 0,BStrap 13,linux-install-rh73 14,linux-install-rh80 15,linux-install-rh90 16,linux-install-su82 # Menu string that will be displayed on the client screen # after F8 is pressed. [X86PC/UNDI/MENU] 0,Local Boot 13,RedHat 7.3 Install Linux 14,RedHat 8.0 Install Linux 15.RedHat 9.0 Install Linux 16.SuSE 8.2 Install Linux # Image file name for Linux install boot server type # format : [X86PC/UNDI/linux-install-su82/ImageFile_Name] 0 2 linux 重新啟動 PXE #service pxe restart or # /etc/init.d/pxe restart Client 端就可以用 PXE 安裝了(記得要上 network modules 喔) 所有的項目皆是用 RedHat Linux 為範例
|