You can create, delete, run, stop, and manage your virtual machines graphically. The tool virt-manager allows you to use a graphical interface to interact with KVM.
Local Installation
Install virt-manager on your desktop:
- From a Command Line
sudo apt-get install virt-manager
- Or from the Ubuntu Software Center:
Applications -> Ubuntu Software Center -> Search for "virt-manager"
- Install "Virtual Machine Manager"
Installation for Remote Server
When you install virt-manager, the packages assumes you have a KVM installation to manage on your desktop. While this is not a totally unreasonable assumption, it is often not correct. And if you do not want to manage a local installation, having it install the suggested packages like "libvirt-bin" can add a lot of weight. But going minimal will leave things out...
- From a Command Line
sudo apt-get install virt-manager ssh-askpass-gnome --no-install-recommends
This will give you virt-manager, and the tool to ask for an ssh password to connect to other servers, and that is all.
Launching
To launch KVM/VirtManager:
Applications -> System Tools -> Virtual Machine Manager
To manage virtual machines on the local system:
- Double-click on "localhost (System)"
Or to connect to any other virtual machine host (running libvirt-bin and openssh-server):
File -> Add Connection
Hypervisor: QEMU/KVM
Connection: Remote tunnel over SSH
Hostname: hostname or IP address of the remote host. For a user other than root use the format username@hostname and make sure the user is part of the libvirtd on the remote server.
Creating a Virtual Machine
- First, download an ISO cd image of some OS you want to run. For Ubuntu, you can find these at:
Double click on the name of the host. The Status column should read Active
Right click on the name of the host, and select New
- This will start a wizard to guide you through the rest of your VM creation
- Enter your virtual machine details
Name: foo
Choose Local install media (ISO image or CDROM), or you can use another method if you know what you're doing
Forward
- Locate your install media
Use ISO image
Browse to find the ISO you downloaded earlier
Optional: Select the matching OS Type
Optional: Select the matching Version
Forward
- Choose Memory and CPU settings
Memory (RAM): 512MB (your choice)
CPUs: 1 (your choice)
Forward
Select Enable storage for this virtual machine
Select Create a disk image on the computer's hard drive
8 GB is the default
To speed up VM creation, you can unselect Allocate entire disk now
Forward
- Ready to begin installation
- Confirm the details
Finish
- You should now see the OS installation proceed within a virt-manager window. Complete the installation and reboot.
- Enter your virtual machine details
Working with a Running Virtual Machine
If you double-click on any machine in Virtual Machine Manager, a new window will open, with functions unique to that virtual machine.
From this window, you apply several actions to this VM:
- Run
- Pause
- Shutdown (cleanly shuts down the VM OS)
- Reboot (cleanly reboots the VM OS)
- Force off (equivalent to yanking the power, could yield data loss in the VM)
- Fullscreen
Console
The Console tab in the main window provides access to the VM's desktop and tty consoles.
- The desktop is accessed over a VNC connection to the guest. When you are "inside" the guest, the keyboard and mouse are "locked" to the guest. To release the keyboard and mouse, press the buttons Ctrl-Alt at the same time.
- The tty console can been accessed by:
Send Key -> Ctrl-Alt-F1
Details
The Details tab provides a view of the resources assigned to this virtual machine. Here, you can see:
- the number of processors allocated
- the amount of memory assigned
- the default boot device (CDROM or Hard Disk)
- a listing of the storage devices attached to the VM and their type (CDROM, IDE, SCSI, Virtio)
- the network adapter and its model
- the emulated mouse, display, serial, and sound hardware
Deleting a Virtual Machine
To delete a virtual machine:
- Shutdown or force off the VM.
- In Virtual Machine Manager, highlight the VM you want to delete
Click Delete at the bottom of the panel
- You can optionally delete the associated disk file for the VM. If you don't want or need the data within the VM itself, you should delete the storage file, as these are usually very large.