วันพฤหัสบดีที่ 15 กรกฎาคม พ.ศ. 2553

CS797 Exercise 4 : KVM Overlay Image

Exercise 4 : KVM using Overlay
1.install CentOS as Guest OS

2. ทำการสร้าง BASE image จะใช้เป็น Back up files
ด้วยคำสั่ง qemu-img create –f qcow2 ovl1.img 4G

3. ทำการ start จาก overlay image 1
ด้วยคำสั่ง qemu-system-x86_64 -had ovl1.img -boot c -m 256 -snapshot



4. แล้วใช้คำสั่ง commit all แล้วกด Ctrl + Alt + 2 เพื่อสลับการทำงานไปที่ KVM mode
5. แล้วทำการสร้าง file ชื่อว่า test.bin ให้มีขนาด 50k
6.ทำการแสดงขนาดของ overlay img

7.แล้วออกจากการทำงาน ด้วยคำสั่ง q





8. ทำการสร้าง overlay image ตัวที่ 2
ด้วยคำสั่ง qemu-img create –f qcow2 ovl2.img 4G

9. ทำการ start จาก overlay image 1
ด้วยคำสั่ง qemu-system-x86_64 -had ovl2.img -boot c -m 256 -snapshot


10. ทำการเช็ค file เปรียบเทียบ overlay image ทั้ง 2 ตัว จะพบว่าที่ overlay1 จะยังคงมี files ชื่อว่า filetest.bin อยู่ ส่วนที่ overlay image2 จะไม่มี file นี้อยู่

วันศุกร์ที่ 9 กรกฎาคม พ.ศ. 2553

CS797 Exercise 3 Compile and Install KVM on your Ubuntu system

Exercise 3 Compile and Install KVM on your Ubuntu system
1. Install vmware on your computer
2. Install Ubuntu on your vmware virtual machine
3. Obtain KVM source code from KVM web site (sourceforge.net)
4. Compile KVM source code and install them on your Ubuntu OS
5. Search the Internet for guideline to compile and install KVM
6. Use the “qemu-img” command (at command line) to create your virtual disk in
the “qcow2” format
7. Download the Damn Small Linux iso image on your Ubuntu
8. Use command line _______________________ to run your KVM and install
Damn Small Linux (DSL) on the virtual disk you just created
9. Take snapshots of the screen showing
◦ Your KVM compilation
◦ The command line used to run KVM from Ubuntu
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
จากการบ้าน ex1 ได้ทำข้อ 1 และ 2 ไปแล้ว และที่การ install KVM บน Ubuntu ไปแล้ว แต่สำหรับครั้งนี้เราจะทำการ remove KVM ออกก่อน แล้วค่อยทำข้อ 3 – 8
Step 1 ทำการ remove KVM

Step 2 Install Program for Compile Source Code






Step 4 Check Version of Kernel ของ Ubuntu
With command : uname -a






Step 5 Unpacking and Configuring
- ดาวน์โหลด kvm-kmod-2.6.32.16 จาก http://sourceforge.net/projects/kvm/files/ และทำการ extract
$ bunzip2 kvm-kmod-2.6.32.16.tar.bz2
$ tar xvf kvm-kmod-2.6.32.16.tar
$ cd kvm-kmod-2.6.32.16
- Compile และ Install
$ ./configure
$ make
$ sudo make install



Step 5 ทำการ Reboot เครื่อง


- เปิด Terminal แล้วพิมพ์คำสั่ง เพื่อ add module ให้กับ kernel
$ sudo /sbin/modprobe kvm-intel


Step 6 qemu-kvm
- ดาวน์โหลด qemu-kvm-0.12.4 จาก http://sourceforge.net/projects/kvm/files/ และทำการ extract
$ tar xvfz qemu-kvm-0.12.4.tar.gz
$ cd qemu-kvm-0.12.4
- Compile และ Install (ติดตั้งไว้ที่ /opt/kvm)
$ ./configure --prefix=/opt/kvm
$ make
$ sudo make install





Step 7 Creating a disk image for the guest
with command :
$ /opt/kvm/bin/qemu-img create -f qcow2 hda.img 3G


Installing DSL (Damn Small Linux)
ติดตั้งลงบน disk image ที่สร้างไว้ (hda.img) โดยใช้ตัวติดตั้งจาก DSL iso ที่ดาวน์โหลดมา
With command :
$ /opt/kvm/bin/qemu-system-x86_64 -hda hda.img -cdrom dsl-4.4.10.iso -boot d -m 256