Agenda: virtualization-lab.txt

File virtualization-lab.txt, 4.3 KB (added by admin, 7 years ago)
Line 
1
2
3-----------------------
4
51. Desktop Virtualization
6
7-- Install VirtualBox on your Desktop
8
9NOTE: This is Optional.  We don't want you to install anything
10on your machine if you feel that it will damage your machine or
11that it is not useful.
12
13-- Download and ISO file to use to install an OS.
14
15If you have your own .ISO, you can use that.
16If not, here are two you might copy from the NOC machine:
17
18        Puppy Linux:
19        http://noc.ws.nsrc.org/downloads/slacko-5.3-MAIN.iso
20
21        Ubuntu Desktop:
22        http://noc.ws.nsrc.org/downloads/ubuntu-10.04.3-desktop-i386.iso
23
24-- Once you have the OS running, see if you can Install the "Extension Pack"
25
26        Usually this will be mounted within the Guest as a
27        temporary virtual CDROM mount. 
28
29        Add the extension pack in the Host.
30        Then return to the Guest and see if you can
31        mount the extension pack inside the Guest.
32
33
34------------------
35
362. VNC Remote Displays for Console
37
38For our next exercises, we need a VNC viewer.
39VNC is a Remote Desktop protocol that normally operates
40over port 5900.  For our exercises, we will use port numbers
41for each user, such as: user1 -> 5901, user2-> 5902, 5903...
42
43-- Install ChickenoftheVNC or other vncviewer client on your laptop
44
45
46------------------
47
483.  Server Virtualization s3.ws.nsrc.org
49
50-- User1 should Login to "s3" using "sysadmX"
51
52        % ssh s3 -l sysadm1
53
54-- Create A VM Disk using "qemu-img"
55
56        % qemu-img create -f qcow2 adm1img.qcow2 6G
57
58-- Boot Up a VM using that disk image using qemu
59   and one of the ISO files in /ISOS.
60   Please use Username: "sysadm", and the password we have been using
61   for the Username that you create.
62   Please Skip the "updates" to save some time.
63
64   a) Use "vnc :#" when starting the qemu, and connect using VNC to "s3:(5900+#)"
65
66        ex. For sysadm1, use: vnc :1  implies host and port will be: s3:5901
67        When you connect with ChickOfTheVNC, you will connect to s3:5901
68        ex. For sysadm2, use: vnc :2 ... s3:5902
69        ex. For sysadm3, the command might be:
70
71        % qemu -hda adm3img.qcow2 -cdrom /ISOS/ubuntu-10.04.3-desktop-i386.iso -vnc :3
72
73   b) Install an Operating System to the first virtual drive.
74
75(NOTE: if you don't want to wait for an install, just copy the virtual hard disk
76 image in from the ISOS directory:
77
78        % cd;
79        % cp /ISOS/ubuntudeskimg.qcow2 sysadmimg
80
81        Then you can start qemu as before, but you can leave the -cdrom ISO option off.
82        You will still need the vnc console.
83
84    c) shutdown that Image
85
86        Within the VNC guest:
87        % sudo shutdown -h -y now
88
89*******************************************************
90*** PLease make sure you are inside your GUEST VM,  ***
91*** NOT on an s3: prompt when you do this!!!        ***
92*******************************************************
93
94------------------
95
964. Snapshots
97
98Create a "Snapshot" Image using "qemu-img"
99with the original image as the basefile.
100
101qemu-img can create a "snapshot" that refers back to a basefile.
102Use your new image as the basefile.  After this, you will start qemu
103using only the new snapshot file.  The basefile will remain read-only
104and will not change.  All writes will go to the new file.
105
106        % qemu-img create -b adm3img.qcow2 -f qcow2 newadm3.qcow2
107
108Notice how small the new file is at this point:
109
110        % ls -lo newadm3.qcow2
111
112Now start the emulator with the new image:
113
114        % qemu -hda newadm3.qcow2 -vnc :3
115
116
117------------------
118
1195. The Qemu Montiro
120
121-- Interrupt the Image Using the QEMU-KVM Monitor
122   CTRL-ALT(OPT)-2 and CTRL-ALT(OPT)-1
123   Try the following commands:
124        > stop
125        > cont
126        > info block
127
128You can attach and detach CDROM drives and USB drives
129and change vnc settings, and many other things within
130the monitor console.  Typically, the monitor is used
131for system operations such as "system_powerdown", or
132"stop" or "cont", or for saving snapshots or for performing
133migrations.
134
135-- Try system_powerdown
136
137Issue the command inside the monitor.
138
139Switch back to the Guest VM using the CTRL command.
140
141Was the monitor able to powerdown the Guest VM?
142
143------------------
144
1456. Optional: virt-manager
146
147Use the "qemu:///session" option so that each user has their
148own session directory.
149
150Remember this is a GUI, so I will use X on my desktop to view
151the GUI.
152
153        From your own laptop:
154        % ssh -X s3 -l sysadmXX
155
156        On the s3 virtual server:
157        % virt-manager -c qemu:///session
158
159See if you can do an install using the GUI interface.
160
161After you finish, check with "virsh":
162
163        % virsh -c qemu:///session
164        > virsh # list --all
165
166---