ติดตั้ง Linux ผ่าน Network ด้วย PXE Server


มาทำความรู้รักกับ PXE กันก่อนครับ
PXE หรือ Preboot eXecution Environment เป็น Open Standard ที่พัฒนาขึ้นโดย Intel ซึ่ง PXE นี้จะยอมให้ Computer ต่างๆ (Server, PC, Laptop, Notebook ที่ BIOS ลองรับ PXE Booting) สามารถ boot ผ่าน network ได้ไม่ต้องง้อ floppy, cd หรือ dvd กันเลยทีเดียว (มันสุดยอดจริงๆ ครับ)

มาลุยกันเลยครับ
Server : CentOS 5.1 + dhcp + tftp-server + httpd + syslinux
Client : Ubuntu 8.04

เอาเป็นว่าทุกๆ ท่านติดตั้ง CentOS ไว้เป็นที่เรียบร้อย ทีนี้ก็เป็นขั้นตอนการติดตั้ง PXE Server ละครับ

แปลงร่างเป็น root

su -

ติดตั้ง dhcp, tftp-server, httpd และ syslinux

yum install dhcp tftp-server httpd syslinux

เตรียม install files (ผมเลือกติดตั้ง Ubuntu 8.04)
>>วิธี mount iso image บน linux

wget http://ftp.science.nus.edu.sg/linux/ubuntu-ISO/8.04/ubuntu-8.04-server-i386.iso
mkdir -p /var/www/html/mirror/ubuntu/8.04
mount -o loop ubuntu-8.04-server-i386.iso /var/www/html/mirror/ubuntu/8.04
cp -fr /var/www/html/mirror/ubuntu/8.04/install/netboot/* /tftpboot


Config tftp-server
โดย default CentOS จะ disable tftp ที่ start ผ่าน xinetd ให้ทำการ configuration file “/etc/xinetd.d/tftp” ใหม่ด้วยการเปลี่ยน “disable = yes” ให้เป็น “disable = no” หรือใช้ sed ทำการแก้ไขก็ได้ครับ

sed -e '/disable/ s/yes/no/' -i /etc/xinetd.d/tftp
#restart xinetd
/etc/init.d/xinetd restart

Config dhcpd
โดย default CentOS จะให้ copy configuration file มาจาก “/usr/share/doc/dhcp*/dhcpd.conf.sample” ส่วนตัวแล้วผมใช้เพียง configuration และ parameters บางตัวเท่านั้น ตามตัวอย่างนี้ครับ

# dhcpd configuration file for pxe boot by kawin@chailerd.com
# /etc/dhcpd.conf
# CentOS 5.1
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
 
subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.10 192.168.1.20;
  filename "pxelinux.0";
}

หลังจากทำการแก้ไข configuration file “/etc/dhcpd.conf” ก็ Start dhcpd ได้เลยครับ

/etc/init.d/dhcpd start

Note : สามารถกำหนดได้ว่าจะให้ dhcpd ใช้ Interface ใดๆ โดย config ที่ file “/etc/sysconfig/dhcpd” ทำการเปลี่ยนค่าของ Interface DHCPDARGS=ethX

เท่านี้ก็สามารถ Install Ubuntu ผ่าน Network โดย PXE Server บน CentOS ได้แล้วครับ
หากเพื่อนๆ มีข้อสงสัยก็ถามมาได้เลยนะครับ webmaster@howtoconfig.com

Tags: , , , , , , , , , , , ,


2 Responses to “ติดตั้ง Linux ผ่าน Network ด้วย PXE Server”

  1. golfreeze Says:

    เด๋วพรุ่งนี้ ไปลองเลย ที่ office อิอิ

  2. jackz Says:

    โอ้ว PXE เป็นอะไรที่ผ่านตากระผมบ่อย แต่ไม่เคยใช้เลย

Leave a Reply