บันทึกกระบวนการติดตั้ง Ubuntu 22.04 สำหรับสร้างเป็น Template บน VMware ขั้นตอนนี้จะข้ามการ Create VM การกำหนด hardware ไป โดยเริ่มต้นจากการ boot เข้าหน้าติดตั้ง Ubuntu เลย ดังภาพ




ไม่ fix ip ไว้ เนื่องจากมี DHCP Server อยู่






กำหนดชื่อผู้ใช้ และรหัสผ่าน

ติดตั้ง OpenSSH server ด้วย แต่ SSH indetify ตั้งค่าเป็น No

Feature ที่สามารถติดตั้งเพิ่มได้ทันที สะดวกมาก ถ้าไม่ติดตั้งอะไรก็ข้ามไป


ถ้าหน้านี้นาน กด Cancel update and reboot
ไปเลย

หรือรอจนกว่าจะเสร็จ จากนั้น Reboot now

กลับมาหน้า console login ให้เรียบร้อยด้วย user, password ที่ตั้งไว้

จากนั้น update ระบบให้เป็นปัจจุบัน
sudo apt-get update
sudo apt-get upgrade -y

จากนั้น reset hostname เพื่อไม่ให้มันจำค่าไว้
sudo sed -i 's/preserve_hostname: false/preserve_hostname: true/g' /etc/cloud/cloud.cfg
sudo truncate -s0 /etc/hostname
sudo hostnamectl set-hostname localhost
ลบการตั้งค่า network โดยลบไฟล์นามสกุล .yaml
sudo rm /etc/netplan/00-xxxx-xxxx.yaml
ลบ shell history
cat /dev/null > ~/.bash_history && history -c
และ shutdown vm นี้
sudo shutdown now
ขั้นตอนสุดท้ายคือ Convert VM เป็น Template ให้เข้าไป Edit Settings โดยลด CPU, Memory ให้เหลือน้อยที่สุด ก่อนจะ convert to template เพื่อให้การใช้งานจริงจะได้ไม่สิ้นเหลืองทรัพยากรเกินความจำเป็น
