วันนี้เราจะมาเล่น QEMU โดยสร้าง Virtual Machine Alpine Linux

ขั้นตอนการสร้าง Virtual Machine
เตรียม image สำหรับการติดตั้ง ดาวน์โหลด Alpine Linux ได้จากที่นี่ https://alpinelinux.org/downloads/
สร้าง qcow2 image ใน KVM
- สร้าง disk image สำหรับติดตั้ง Alpine Linux.
qemu-img create -f qcow2 alpine.qcow2 8G
- เริ่ม QEMU ด้วยไฟล์ image ISO ของ Alpine กำหนดค่าเริ่มต้นของ RAM 512MB โดยใช้คำสั่งนี้
qemu-system-x86_64 -m 512 -nic user -boot d -cdrom alpine-standard-3.21.0-x86_64.iso -hda alpine.qcow2 -display gtk -enable-kvm
ติดตั้ง Alpine Linux
ล็อกอิน
rootโดยไม่ต้องใส่ password:ใช้คำสั่ง setup
setup-alpine
- กำหนดค่าเริ่มต้นต่างๆ

1. เลือก Keyboard Layout
2. ตั้ง Hostname (The name for the computer.)
3. Network Setup [eth0]
4. Do you want to do any manual network configuration? (y/n) [n] (Default uses "DHCP".)
5. กำหนด DNS Servers
6. กำหนด Root password (the password used to login to the root account)
7. กำหนด Timezone (Optionally display times/dates in your local time zone)
8. กำหนด HTTP/FTP Proxy (Proxy server to use for accessing the web/ftp. Use "none" for direct connections to websites and FTP servers.)
9. เลือก Mirror (From where to download packages. Choose the organization you trust giving your usage patterns to.)
10. เพิ่ม user อื่น (Setting up a regular user account)
11. เลือก Disk Mode
รอทำการติดตั้งจนเสร็จ
รัน
poweroffเพื่อปิดเครื่อง
Booting QEMU Virtual Machine
หลังจากการติดตั้งแล้ว สามารถเริ่ม QEMU จากดิสก์อิมเมจได้โดยไม่ต้องใช้ CDROM โดยใช้คำสั่งนี้
qemu-system-x86_64 -m 512 -name valpinetest -hda alpine.qcow2
