Differences

This shows you the differences between two versions of the page.

Link to this comparison view

scgc:laboratoare:05 [2020/03/23 19:51]
maria.mihailescu fix spelling
scgc:laboratoare:05 [2021/10/27 19:18] (current)
maria.mihailescu [9. [5p] Running KVMs as an unprivileged user]
Line 1: Line 1:
-===== Laboratory 05. Native virtualization =====+===== Native virtualization =====
  
 ===== Lab Setup ===== ===== Lab Setup =====
  
-  * We will be using a virtual machine in the [[http://​cloud.curs.pub.ro/​|faculty'​s cloud]].+  * We will be using a virtual machine in the [[http://​cloud.grid.pub.ro/​|faculty'​s cloud]].
   * When creating a virtual machine follow the steps in this [[https://​cloud.curs.pub.ro/​about/​tutorial-for-students/​|tutorial]].   * When creating a virtual machine follow the steps in this [[https://​cloud.curs.pub.ro/​about/​tutorial-for-students/​|tutorial]].
   * When creating a virtual machine in the Launch Instance window:   * When creating a virtual machine in the Launch Instance window:
-    * For **Availability zone**, choose **CAMPUS**, **CI** or **hp** 
     * Select **Boot from image** in **Instance Boot Source** section     * Select **Boot from image** in **Instance Boot Source** section
     * Select **SCGC Template** in **Image Name** section     * Select **SCGC Template** in **Image Name** section
Line 144: Line 143:
 ==== 3. [10p] Add new resources to a KVM ==== ==== 3. [10p] Add new resources to a KVM ====
  
-usual configuration of a VM consists of 2 virtual disks: one main disk that hosts the OS and a second one that hosts the actual user data.+usual configuration of a VM consists of 2 virtual disks: one main disk that hosts the OS and a second one that hosts the actual user data.
  
 Create a new virtual disk in the ''​qcow2''​ format, with a 1G maximum size and attach it to a VM that has as a main disk the ''​base.qcow2''​ image. The virtual machine should have 256MB and 2 cpus. **Hint : -hdb**. Create a new virtual disk in the ''​qcow2''​ format, with a 1G maximum size and attach it to a VM that has as a main disk the ''​base.qcow2''​ image. The virtual machine should have 256MB and 2 cpus. **Hint : -hdb**.
Line 305: Line 304:
 For system administrators,​ a command line interface was developed called ''​virsh''​ as a front-end for libvirt. ​ For system administrators,​ a command line interface was developed called ''​virsh''​ as a front-end for libvirt. ​
  
-In order to use the facilities offered by ''​libvirt''​ we must instal ​first the following packets: ''​libvirt-bin'',​ ''​virtinst'',​ ''​virt-viewer''​ and ''​virt-top''​. Also, if we do not intend to use libvirt as ''​root'',​ the user should be added to the ''​libvirtd''​ group.+<​note>​ 
 +In order to use the facilities offered by ''​libvirt''​ we must first install ​the following packets: ''​libvirt-bin'',​ ''​virtinst'',​ ''​virt-viewer''​ and ''​virt-top''​. Also, if we do not intend to use libvirt as ''​root'',​ the user should be added to the ''​libvirtd''​ group. 
 +</​note>​
  
 As a first step, we must enable the networking service provided by ''​libvirt'':​ As a first step, we must enable the networking service provided by ''​libvirt'':​
Line 347: Line 348:
 Notice the state of the virtual machines and its ID (in this case 3). The following operations will be issued using this ID. Notice the state of the virtual machines and its ID (in this case 3). The following operations will be issued using this ID.
  
-Display the VNC port of the ''​VM1''​ guest using the ''​vncdisplay''​ command followed ​bu the VM ID:+Display the VNC port of the ''​VM1''​ guest using the ''​vncdisplay''​ command followed ​by the VM ID:
 <code bash> <code bash>
 virsh # vncdisplay 3 virsh # vncdisplay 3
Line 357: Line 358:
 root@scgc:​~#​ vncviewer :0 root@scgc:​~#​ vncviewer :0
 </​code>​ </​code>​
 +
 +<note important>​
 +The ''​virsh''​ utility may open a viewer for the virtual machine when starting it. You must close the viewer before being able to connect to the virtual machine.
 +</​note>​
  
 Close the VNC console. The guest will continue to run in background. Close the VNC console. The guest will continue to run in background.
Line 412: Line 417:
 virsh # undefine VM1 virsh # undefine VM1
 Domain VM1 has been undefined Domain VM1 has been undefined
-virsh # list 
- Id Name                 State 
----------------------------------- 
-  6 VM1                  running 
-</​code>​ 
- 
-Notice that the VM is still running. It will disappear completely when stop it: 
-<code bash> 
-virsh # shutdown 6 
-Domain 6 is being shutdown 
 virsh # list --all virsh # list --all
  Id Name                 State  Id Name                 State
Line 427: Line 422:
 </​code>​ </​code>​
  
 +<note important>​
 +Note that if the VM is still running when the ''​undefined''​ command is issued, it will not be destroyed. It will disappear completely when it is stopped.
 +</​note>​
 ==== 9. [5p] Running KVMs as an unprivileged user ==== ==== 9. [5p] Running KVMs as an unprivileged user ====
  
-Create a new system group ''​kvm-users''​ and add the user ''​student''​ to this newly created group. Configure the system so that all the users that are in this group can start and manage KVM machines.+Create a new system group ''​kvm''​ and add the user ''​student''​ to this newly created group. Configure the system so that all the users that are in this group can start and manage KVM machines.
  
scgc/laboratoare/05.1584985884.txt.gz · Last modified: 2020/03/23 19:51 by maria.mihailescu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0