PXE ( Preboot eXecution Environment hay Pre-execution Environment ) là môi trường để cài đặt và khởi động máy tính bằng network interface. Máy client sẽ lấy file cài đặt từ PXE server thông qua TFTP. Do đó, PXE là sự lựa chọn tốt nhất khi bạn cần cài đặt cho nhiều máy cùng lúc hoặc cho nhưng máy không có ổ đĩa CD/DVD.
Triển khai toàn bộ hệ thống nhanh chóng với PXE Server
PXE ( Preboot eXecution Environment hay Pre-execution Environment ) là môi trường để cài đặt và khởi động máy tính bằng network interface. Máy client sẽ lấy file cài đặt từ PXE server thông qua TFTP. Do đó, PXE là sự lựa chọn tốt nhất khi bạn cần cài đặt cho nhiều máy cùng lúc hoặc cho nhưng máy không có ổ đĩa CD/DVD.
1) Triển khai PXE server Yêu cầu: PXE server ( CentOS ) + PXE client ( Card mạng có hỗ trợ boot code ) - Cài tftp-server, dhcp, httpd, syslinux. - Sữa file cấu hình tftp
- Tạo file remap với nội dụng:
- Copy các file sau vào /tftpboot:
cp /usr/lib/syslinux/pxelinux.0 /tftpboot cp /usr/lib/syslinux/menu.c32 /tftpboot |
- Tạo thư mục /pxelinux.cfg trong /tftpboot - Tạo file default trong /pxelinux.cfg
prompt 1 default menu.c32 timeout 100 label Linux kernel vmlinuz append initrd=initrd.img ramdisk_size=9216 noapic acpi=off label Window kernel Boot/startrom.0 append – |
- Copy vmlinuz và initrd.img ( trong thư mục isolinux trên bộ đĩa cài linux ) vào /tftpboot/images/centos. - Copy bộ đĩa cài đặt linux vào /tftpboot/centos - Thêm các dòng sau vào file cấu hình dhcpd
allow booting; allow bootp; option option-128 code 128 = string; option option-129 code 129 = text; next-server 192.168.0.20; filename "/pxelinux.0"; |
- Thêm các dòng sau vào file cấu hình httpd
Options Indexes AllowOverride None
|
- Cài và cấu hình samba - Tạo thư mục /share - Chép bộ cài đặt Windows vào /share - Download Window AIK - Cài .NET Framework, MSXML, Window AIK vào thư mực c:waik
cd waiktoolspetools copype.cmd x86 c:win7pe imagex /mountrw winpe.wim 1 mount |
- Tạo thư mục chứa file PXE - Copy các file cần thiết vào thư mục c:pxe
cd win7pemountwindowsbootpxe copy * pxe cd win7pemountwindowsbootfonts copy wgl4_boot.ttf pxe cd waiktoolspetoolsx86boot copy boot.sdi pxe cd win7pe copy winpe.wim pxe |
- Tạo BCD file
cd win7pemountwindowssystem32 bcdedit /createstore pxeBCD bcdedit /store pxebcd /create {ramdiskoptions} /d "Ramdisk options" bcdedit /store pxebcd /set {ramdiskoptions} ramdisksdidevice boot bcdedit /store pxeBCD /set {ramdiskoptions} ramdisksdipath Bootboot.sdi bcdedit /store pxeBCD /create /d "MyWinPE Boot Image" /application osloader |
- Bạn sẽ được một dãy: {xxxxxxxx-xxxx-xxxx-xxxxxxxxxx}
bcdedit /store pxeBCD /set {xxxxxxxx-xxxx-xxxx-xxxxxxxxxx}systemroot Windows bcdedit /store pxeBCD /set {xxxxxxxx-xxxx-xxxx-xxxxxxxxxx}detecthal Yes bcdedit /store pxeBCD /set {xxxxxxxx-xxxx-xxxx-xxxxxxxxxx}winpe Yes bcdedit /store pxeBCD /set {xxxxxxxx-xxxx-xxxx-xxxxxxxxxx}osdevice ramdisk=[boot]BootWinPE.wim,{ramdiskoptions} bcdedit /store pxeBCD /set {xxxxxxxx-xxxx-xxxx-xxxxxxxxxx}device ramdisk=[boot]BootWinPE.wim,{ramdiskoptions} bcdedit /store pxeBCD /create {bootmgr} /d "Windows VISTA BootManager" bcdedit /store pxeBCD /set {bootmgr} timeout 30 bcdedit /store pxeBCD /displayorder {xxxxxxxx-xxxx-xxxx-xxxxxxxxxx} |
- Bây giờ, copy tất cả các file trong thư mục c:pxe vào /tftpserver/Boot trên PXE server - Trở lại PXE server, nhập lệnh sau để đổi tên file
cd /tftpboot/Boot mv pxeboot.n12 startrom.0 mv bootmgr.exe .. mv winpe.wim WinPE.wim |
2) Cài Đặt Windows Client từ PXE Server
- Nhập lệnh sau để client kết nối vào thư mục /share trên PXE server và lấy bộ cài đặt Windows X:Windowssystem32>net use h: 192.168.0.20share - Nhập username và password mà chúng ta đã tạo bước cài đặt và cấu hình Samba. Username: kenhgiaiphapvn Password: 123 - Quá trình cài đặt windows sẽ tự động được kích hoạt. 3) Cài đặt Linux Client từ PXE Server
Sự ra đời của PXE đã giúp cho việc cài đặt các máy clients (Linux + Windows) (của người quản trị) trở nên dễ dàng, tiết kiệm chi phí và thời gian. Nếu như trước kia, khi bạn cần cài đặt hệ điều hành cho hàng loạt máy tính, bạn phải burn rất nhiều đĩa để cài cho từng máy. Điều này khiến bạn mất khá nhiều thời gian và lãng phí. Giờ đây, bạn chỉ cần cài đặt một PXE server để client kết nối vào và lấy thông tin cài đặt.
( Nguồn: wiki.centos.org, linux-sxs.org )
|