Import Red Hat vdi to KVM under Ubuntu

All of us knows VMware and VirtualBox solutions, and they do their job quite good.. But there is an open-source product, supported by Red Hat and IBM and other vendors, which is named every time they give their speeches — KVM. This software is quite adult, and Red Hat company bought it a few years ago for more than $100 million, and IBM made their own copy of this product in search of best productivity with their new processor power 8..

But all I want is to work it on my laptop and not to consume too much energy or processor time, and I hope it won’t hung as VirtualBox does — actually, every time I run VB, I have to do some magic — like restoring config file or reimport VDI. It’s weird for me, since it worked perfectly under Windows. And VMware made my laptop to have natural fever. I’m not going to say their products are bad — the reason is I have non-standard laptop configuration, and I don’t want to spend time inventing workarounds for each software item that doesn’t run properly, if I can replace it with software than can run as desired.

So, let’s bury our VirtualBox recollections and move our VDI’s to QEMU.

Check if your system supports KVM:

In my case I got

Then install libraries

Notice: the last package in the list is optional, it’s a graphic interface for KVM. I used it, anyway.

The next thing you should do is to convert your vdi to qcow2. Since it’s linux, there is an useful utility for it.

The next step is to import your new VM to your hypervisor. And again there is an useful utility

I had problems for the first time I imported  VM, bumping into warning no bootable device , then, to my shame, I found out that there were spaces in a directory name (as I use used the same HDD under linux and windows).

Then run your virtual machine manager (I used graphical interface, it was easy to find it in the menu). When I ran it for the first time, it refused to connect to qemu, gaving warning  libvirt-sock': Permission denied  . Strange, but rebooting my machine resolved the issue.

Now I have natively supported VM.

VirtualBox autostart in background (Win 7)

Add path to your VirtualBox installed folder to Environment Variables start->Control Panel->System->Advanced System Settings->advanced->Environment Variables

 

ev1
ev2
Then open your startup folder. You may get there using menu or go through folders.  In my case, full path to it is C:\Users\samsung\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup startup
Next, create new file there — it must have  .cmd   or  .bat   extension. Be sure you checked off the needed option at the Folder Options. Call the file the way you like. forlder_options
Copy this text to the file — set your virtual machine name as you called during creating of VM

 

 ubuntu
Reboot your computer. You’ll see black window for a moment at start, and after it’ll disappear. Your VM now works in truly background.

 

 

 

 

 

 

Setup SSH access between VirtualBox Host and Guest VMs

Taken here

It is often necessary to have the ability to SSH between your Linux Host and your Guest virtual machines. In VirtualBox you can do this by simply configuring a second network interface on the Guest. This type of setup will not only allow SSH sessions between Host and Guest, but also between separate Guests themselves.

First off shutdown your Guest VM so that you can add a second network interface. By default you should have one interface already which is using NAT. Leave this alone as it provides access to the internet. Select the tab “Adapter 2″ and change “attached to” to “Host-only Adapter”.

Now boot up your Guest and pull up a terminal. Run ifconfig to see what base address eth1 has been assigned. You can use this address as a base to assign static IP addresses for each Guest VM. In this case inet addr:192.168.56.101 is the base IP address.
$ sudo ifconfig eth1
Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: XXXX::XXXX:XXXX:XXXX:XXXX/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:296 errors:0 dropped:0 overruns:0 frame:0
TX packets:237 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:32116 (31.3 KiB) TX bytes:37642 (36.7 KiB)

If you rely on DHCP you might get a different IP address each time your Guest VM reboots. If this is a problem, you need to setup a static IP address instead.

On a Debian based system edit /etc/network/interfaces to add the following lines. Change the address to your base IP address.
auto eth1
iface eth1 inet static
address 192.168.56.101
netmask 255.255.255.0

On a redhat based system edit this file /etc/sysconfig/network-scripts/ifcfg-eth1 and add the following lines. Change the IPADDR to your base IP address.
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.56.101
NETMASK=255.255.255.0

On your Linux Host you can now open a terminal add ssh to the Guest VM:
$ ssh ryan@192.168.56.101

If you are having problems connecting, make sure that sshd in installed and running, and that the firewall on the is not blocking the SSH service on the VM.

You can create an entry in /etc/hosts so you don’t have to remember the IP address.
192.168.56.101 virtualhost1

This allows you to use the virtual hostname instead.
$ ssh ryan@virtualhost1