Category: KVM

March 30th, 2015 by ronny

virtual-dvd-drive-iconKVM virtualisation is a Kernel based virtualisation. It actually stands for Kernel-based Virtual Machine. It means that each of your virtual machine will have it´s own virtual hardware, such as network card, graphic card, memory and hard drive.

To setup KVM virtualisation it require a multicore cpu. And virtualisation needs to be activated in the BIOS. Look for virtualisation, Intel VT-x (vmx) or AMD-v settings, and enable it. You might be able to install KVM without virtualisation enabled in the BIOS. But the virtual machines will be extremely slow.

Here is how to install KVM on a minimal Debian installation.

First we assume a ssh server is installed, and sudo.

Step 1:
First we install the essential packages for KVM.
apt-get install kvm libvirt-bin virtinst bridge-utils

If you want to be able to controll the virtual machines from your own users instead of root. Add your user to the libvirt group.
adduser john libvirt

Step 2:
To be able to give network access to your virtual computers you will need to bridge your network card. To do this we will change the network interface file. (Change the ip´s to match your network)
nano /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
iface eth0 inet manual

# Initial bridge
auto br0
iface br0 inet static
bridge_ports eth0
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

Now you need to reboot your system and verify you can access from ssh and that it has the network accesses you need.

Check out my previous article about how to install libvirt manager on how to create and control the virtual machines.

That´s it for installing KVM on a Debian.

Happy virtualisation!

Posted in Debian, KVM, Linux, Ubuntu, Virtualization

December 28th, 2014 by ronny

virtual-desktop-2-iconI prefer using a gui when controlling my virtual machines. Learning how to control them in the most basic way from the command line or terminal is easy. It is very self explanatory once you know about the virsh command. I have made some examples below on how to use these commands.

Here is the list of basic commands to start, stop and reboot your virtual machines.

List your running guests

virsh list
[sourcecode language=”text”]
Id Name State
—————————————————-
2 apt-cacher.home running
[/sourcecode]

List all guests:

virsh list –all
[sourcecode language=”text”]
Id Name State
—————————————————-
2 apt-cacher.home running
– db1.home shut off
– db2.home shut off
– devlab.home shut off
– minecraft.home shut off
– vault.home shut off
– web.home shut off
[/sourcecode]

To start a vm

we can only use their vm name to start them.
virsh start db1.home

To reboot a vm

We can use name or id to reboot the vm.
virsh reboot 2
virsh reboot apt-cacher.home

To stop or shutdown a vm

virsh shutdown 2
virsh shutdown apt-cacher.home

To shutdown or stop an unresponsive or crashed vm

virsh destroy 2
virsh destroy apt-cacher.home

To get information about your vm

virsh dominfo 2
virsh dominfo apt-cacher.home
[sourcecode language=”text”]
Id: 2
Name: apt-cacher.home
UUID: f194bb17-5f0e-21f5-f712-8a98edd4f1d8
OS Type: hvm
State: running
CPU(s): 1
CPU time: 332.8s
Max memory: 262144 KiB
Used memory: 262144 KiB
Persistent: yes
Autostart: enable
Managed save: no
Security model: apparmor
Security DOI: 0
Security label: libvirt-f194bb17-5f0e-21f5-f712-8a98edd4f1d8 (enforcing)
[/sourcecode]
Happy controlling!

Posted in Debian, KVM, Linux, Linux Mint, Ubuntu, Virtualization

June 11th, 2014 by ronny

kvm-logoThe Virtual Machine Manager is a small powerful tool when it comes to handling your kvm guests. To install the Virtual Machine Manager we do:
apt-get install virt-manager

It is now ready to run. However to connect to your KVM hosts you need also to install a ssh askpass software.
apt-get install ssh-askpass

First time you connect to your host you need to confirm the fingerprint. If you have accessed the host via ssh, and done re-installs, chances are the fingerprint won’t match. One simple solution to this is to delete the known_hosts file, or modify it if you are comfortable doing that. Normally on a Debian based system it’s located (example assume user is jondoe): /home/jondoe/.ssh/known_hosts

Happy Virtualization!

Posted in Debian, KVM, Linux Mint, Ubuntu, Virtualization

Optimization WordPress Plugins & Solutions by W3 EDGE