Sie sind auf Seite 1von 14

Introduction to Virtualization and

Cloud Computing Lab

1
Exercise 1: Create a VM using VMWare Workstation
Solution:

Host: Windows Operating System

Guest: Any OS

Steps:

1) Install VM Ware Workstation in Host


2) Open VMWare Workstation
3) Click File. Select New Virtual Machine

4) Then choose Typical

2
.
5) VMware will prompt you for the installation media. If it recognizes the
operating system, it will enable Easy Installation:

Physical disc – Insert the installation disc for the operating system you
want to install and then select the drive in VMware.

ISO image – Browse to the location of the ISO file on your computer.

Install operating system later. This will create a blank virtual disk. You
will need to manually install the operating system later.

6) Name your virtual machine. The name will help you identify it on your
physical computer. It will also help distinguish between multiple virtual
computers running different operating systems.

3
7) Set the disk size. You can allocate any amount of free space on your
computer to the virtual machine to act as the installed operating system’s
hard drive. Make sure to set enough to install any programs that you want
to run in the virtual machine.
Select – Store virtual disk as Single File

8) Click Next and Finish

4
9) To Modify RAM : Select- Edit Virtual Machine Settings

10) Change Memory Configuration

5
11) Set the virtual machine to start. Check the box labeled “Power
on this virtual machine after creation”

6
Exercise 2: Create VM using QEMU

Solution:
Host: Ubuntu
Guest: Any Operating System

Steps:

1) Open Terminal in Ubuntu


2) sudo apt-get install qemu-kvm
3) sudo reboot
4) sudo qemu-img create winxp 10G
5) qemu-system-x86_64 -hda winxp -cdrom cd.iso -m 1024 -boot d
[ cd.iso – Specify the path.
For example: /home/student/Downloads/windows_xp.iso ]

7
Exercise 3: Folder Sharing

Solution:
Host: Windows
Guest: Ubuntu

Steps:

In Host:
1) Create folder and enable sharing option for that. [ Folder Properties –>
Sharing -> Share -> Everyone -> Add -> Share -> Done ]

In Guest:
1) Launch VMware and right-click the name of the virtual machine
you wish to manage. Click "Virtual Machine Settings" to display
the Virtual Machine Settings window.

2) Click "Options" and then click "Shared Folders." The window


displays the Folder Sharing options in its right panel. Click the
"Always Enabled" radio button to select it and then click "Map as a
Network Drive in Windows Guests." Choosing that option makes it
easier for you to share folders because your host machine will
appear as a folder in your guest machine.

8
3) Click "Add" to launch the "Add Shared Folder" wizard. Click
"Next" and then click "Browse" to view your hard drive's folders.
Click the folder you'd like to share and then click "OK."

9
4) Click "Next" and review the check boxes in the Additional
Attributes section. The "Enable this Share" check box is checked
by default. Leave that check mark there and place a check mark in
the "Read-only" check box if you want to make the shared folder
read-only. If you choose that option, the guest machine cannot
write to the shared folder. Click "Finish" and then click "OK" to
close the Virtual Machine Settings window and return to the main
window that displays your virtual machines.

10
5) Power on VM
6) All shared folders will be in /mnt/hgfs folder.

11
Exercise 4: Scale-Up and Scale-Down VM resources

Solution:

Host: Ubuntu
Guest: Any Operating System

Steps to create VM:

1) Open Terminal in Ubuntu


2) sudo apt-get install kvm
3) sudo apt-get install libvirt-bin
4) sudo virsh -c qemu:///system
a. list --all
b. ctrl c
5) sudo apt-get install virt-manager
6) Open Virtual Machine Manager --> Create VM (using GUI)
7) After the OS installation ---> Open Ubuntu Terminal

Method 1: To modify VCPU and Memory

1) virsh start VM_Name


2) virsh dominfo VM_Name
3) virsh edit VM_Name ------>[ Modify VCPU and Memory]
4) virsh shutdown VM_Name
5) virsh start VM_Name
6) virsh dominfo VM_Name

Method 2: To modify VCPU and Memory

1) virsh start VM_Name


2) virsh dominfo VM_Name
3) virsh dumpxml VM_Name > a.xml
4) gedit a.xml ------>[ Modify VCPU and Memory]
5) virsh shutdown VM_Name
6) virsh create a.xml
7) virsh dominfo VM_Name

12
Exercise 5: Attach and detach a new storage volume

Solution:

Host: Ubuntu
Guest: Any Operating System

Steps to create VM:

1) Open Terminal in Ubuntu


2) sudo apt-get install kvm
3) sudo apt-get install libvirt-bin
4) sudo virsh -c qemu:///system
a. list --all
b. ctrl c
5) sudo apt-get install virt-manager
6) Open Virtual Machine Manager -> Create VM (using GUI)
7) After the OS installation ---> Open Ubuntu Terminal

Steps Attach Disk:

1) cd /var/lib/libvirt/images/
2) sudo qemu-img create -f raw new_volume.img 1G
3) virsh attach-disk VM_Name --source
/var/lib/libvirt/images/new_volume.img --target vdb

Steps to Detach Disk:


1) virsh detach-disk VM_Name vdb

13
Exercise 5: Generate Report on resource usage

Solution:

Host: Ubuntu
Guest: Any Operating System

Steps to create VM:

1) Open Terminal in Ubuntu


2) sudo apt-get install kvm
3) sudo apt-get install libvirt-bin
4) sudo virsh -c qemu:///system
a. list --all
b. ctrl c
5) sudo apt-get install virt-manager
6) Open Virtual Machine Manager -> Create VM (using GUI)
7) After the OS installation ---> Open Ubuntu Terminal

Steps to generate report:

1) sudo apt-get install virt-top


2) virt-top --csv report.csv
3) gedit report.csv

[For other options: virt-top - -help]

14

Das könnte Ihnen auch gefallen