บทความนี้เป็นตอนต่อจาก “ติดตั้ง FOG Project บน Ubuntu 18.04 Server” หลังจาก แตกไฟล์ มาเสร็จแล้ว มาดูขั้นตอนติดตั้ง
sudo ./installfog.sh

เลือก 2

กด Y และ Enter

กด N และ Enter

ตัวอย่าง จะติดตั้ง fog server ให้ใช้ IP 10.0.100.254 และ ตอบ N ทุกคำถาม Would you like … ตรงนี้ ซึ่งจะเกี่ยวข้องกับ DHCP server ว่า จะติดตั้งลงใน fog server มั้ย

ตรวจสอบ พร้อมแล้ว ก็กด Y และ Enter

สำหรับ Ubuntu 18.04 นั้น ถ้าเราติดตั้ง MySQL ไม่จำเป็นต้องตั้ง password เราก็ใช้คำสั่ง mysql เพื่อเข้าไปทำงานได้ ก็ต่อเมื่อ เราเป็น user ที่เป็น sudo จึงไม่ต้องตั้ง password แต่จะตั้งก็ได้ ไม่ผิด

ใกล้เสร็จแล้ว ให้ไปที่หน้าเว็บ http://fog_server_ip/fog/management เพื่อตั้งค่า database

แล้วกลับมาทำการตั้งค่าต่อ กด Enter

สังเกต มีคำว่า Skipped ที่บรรทัด DHCP Server

เสร็จกระบวนการติดตั้ง fog server
ถัดไปจะติดตั้ง dnsmasq เพื่อเป็น Proxy DHCP ไปติดต่อกับ DHCP server ของตึก

ทำตาม link นี้ https://wiki.fogproject.org/wiki/index.php?title=ProxyDHCP_with_dnsmasq

พิมพ์คำสั่งเพื่อติดตั้ง ดังนี้
sudo apt install dnsmasq -y
เสร็จแล้ว ไปหาเครื่องที่สามารถใช้งานแบบ กราฟิก GUI เพื่อ copy ข้อความหลาย ๆ บรรทัดได้ เช่น เปิด bash ใน Windows แล้วใช้คำสั่ง ssh เข้าไปยัง fog server IP ดังนี้
ssh mama@10.0.100.254

จะทำให้สะดวกกว่า คีย์เอง ทีละบรรทัด

สร้างไฟล์ชื่อ fog.conf ไว้ภายในไดเรกทอรี /etc/dnsmasq.d ใส่ข้อความ ดังนี้


ข้อความที่จะให้ copy ไป paste คือ
# Don't function as a DNS server: port=0 # Log lots of extra information about DHCP transactions. log-dhcp # Set the root directory for files available via FTP. tftp-root=/tftpboot # The boot filename, Server name, Server Ip Address dhcp-boot=undionly.kpxe,,10.0.100.254 # Disable re-use of the DHCP servername and filename fields as extra # option space. That's to avoid confusing some old or broken DHCP clients. dhcp-no-override # inspect the vendor class string and match the text to set the tag dhcp-vendorclass=BIOS,PXEClient:Arch:00000 dhcp-vendorclass=UEFI32,PXEClient:Arch:00006 dhcp-vendorclass=UEFI,PXEClient:Arch:00007 dhcp-vendorclass=UEFI64,PXEClient:Arch:00009 # Set the boot file name based on the matching tag from the vendor class (above) dhcp-boot=net:UEFI32,i386-efi/ipxe.efi,,10.0.100.254 dhcp-boot=net:UEFI,ipxe.efi,,10.0.100.254 dhcp-boot=net:UEFI64,ipxe.efi,,10.0.100.254 # PXE menu. The first part is the text displayed to the user. The second is the timeout, in seconds. pxe-prompt="Booting FOG Client", 1 # The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86, # Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI # This option is first and will be the default if there is no input from the user. pxe-service=X86PC, "Boot to FOG", undionly.kpxe pxe-service=X86-64_EFI, "Boot to FOG UEFI", ipxe.efi pxe-service=BC_EFI, "Boot to FOG UEFI PXE-BC", ipxe.efi dhcp-range=10.0.100.254,proxy
ให้แทนที่ 10.0.100.254 ด้วย fog server IP ของคุณ แล้ว save ออกมาจากการแก้ไขไฟล์ แล้ว ตรวจสอบด้วยการรัน service ดูว่า ทำงานได้ ไม่ error

รันคำสั่งดังนี้
sudo systemctl restart dnsmasq.service
ตรวจสอบ status
sudo systemctl status dnsmasq.service
กด q ออก
ถ้ามี error ให้ตรวจสอบว่า ในไดเรกทอรี /etc/dnsmasq.d มีไฟล์คอนฟิกสักไฟล์ที่มีคำว่า bind-interfaces อยู่ข้างในมั้ย ถ้าไม่มีก็สร้างไฟล์ชื่อ etc.conf และมี 1 บรรทัดใส่คำว่า bind-interfaces และ save แล้ว รีสตาร์ท dnsmasq ก็น่าจะใช้งานได้
แล้วตั้งค่าให้ dnsmasq ทำงานเมื่อเปิดเครื่อง

รันคำสั่ง
sudo systemctl enable dnsmasq.service

ออกจาก ssh และ reboot fog server เพื่อดูว่า service dnsmasq เรียบร้อย

เมื่อ boot Windows 7 จะเห็นว่า มันจะไปขอ DHCP IP จาก 10.0.100.1 ในที่นี้คือ DHCP server ของตึก (router) และมันจะรู้ด้วยว่า fog server คือ 10.0.100.254

ตัวอย่าง ใน LAN configuration ก็จะมีข้อมูลบอกว่า DHCP Server ที่แจก IP มาให้ Windows คือ 10.0.100.1

เมื่อดูใน /var/log/syslog ของเครื่อง fog server จะเห็น service dnsmasq ทำงาน
ต่อไปเป็นการใช้งาน เพื่อทดสอบว่า กระบวนการติดตั้ง fog server ใช้งานแบบ proxy DHCP ทำงานได้จริง

เลือกรายการ Quick Registration and Inventory เพื่อลงทะเบียนแบบ manual ทีละเครื่อง

แล้วกลับมาอีกรอบ คราวนี้ก็เลือก Boot from hard disk เมื่อเข้า Windows ได้แล้วลองไปตรวจสอบ IP

หน้าต่าง login ก็ใส่ค่า default username คือ fog และ password คือ password
ต่อไปมาดูในหน้าเว็บ ของ fog จะเห็นว่า มีเครื่องที่เรากด ลงทะเบียน เข้ามาแล้ว

ต่อไป เราจะไปหน้าเว็บเพจ images เพื่อสร้างชื่อ image ว่า windows7 ก่อนที่จะ cloning ได้

กดเลือก Create New Image

ตั้งค่าเลือก Operating System เป็นชนิด Windows 7 – (5)

และใช้ค่า default แล้วกด Add (วันหลังค่อยลองเปลี่ยนใช้แบบอื่น ๆ)

เราต้องผูก image เข้ากับ host ให้คลิกเข้าไปที่ชื่อ host ในตัวอย่างคือ 080027888888

ผูก host นี้กับ Image ชื่อ windows7 ที่เราสร้างไว้

ส่วนที่เหลือ เป็นค่า default แล้วกด Update

กลับมาที่หน้าเว็บเพจ Host จะเห็นว่ามี Assigned Image เข้ามาแล้ว ให้คลิก Capture

หน้านี้จะเด้งขึ้นมา เป็นค่า default ทั้งหมด แล้วกด Task

จะได้หน้าต่างบอกว่า กำหนด Task แล้ว

ไปที่เมนู Tasks จะเห็นรายการว่า กำลังรอให้เรา cloning ต้นฉบับ
เราก็ไปเปิดเครื่อง Windows ต้นฉบับที่จะเก็บ

มันก็จะขึ้นมาเรื่อย ๆ แบบนี้ จนได้หน้าต่างว่า กำลังใช้ Partclone ในการ cloning

ก็รอจนเสร็จ
ขอให้สนุก