Virtualization With KVM On A CentOS 6.2 Server - Page 2

5 Connecting To The Guest

Fedora 16 Desktop:

The KVM guest will now boot from the Debian Squeeze Netinstall CD and start the Debian installer - that's why we need to connect to the graphical console of the guest. You can do this with virt-manager on the Fedora 16 desktop.

Go to Applications > System Tools > Virtual Machine Manager to start virt-manager:

When you start virt-manager for the first time, you will most likely see the following message (Unable to open a connection to the libvirt management daemon.). You can ignore this because we don't want to connect to the local libvirt daemon, but to the one on our CentOS 6.2 KVM host. Click on Close...

... and go to File > Add Connection... to connect to our CentOS 6.2 KVM host:

Select QEMU/KVM as Hypervisor, then check Connect to remote host, select SSH in the Method drop-down menu, type in root as the Username and the hostname (server1.example.com) or IP address (192.168.0.100) of the CentOS 6.2 KVM host in the Hostname field. Then click on Connect:

If this is the first connection to the remote KVM server, you must type in yes and click on OK:

Afterwards type in the root password of the CentOS 6.2 KVM host:

You should see vm10 as running. Mark that guest and click on the Open button to open the graphical console of the guest:

Type in the root password of the KVM host again:

You should now be connected to the graphical console of the guest and see the Debian installer:

Now install Debian as you would normally do on a physical system. Please note that at the end of the installation, the Debian guest needs a reboot. The guest will then stop, so you need to start it again, either with virt-manager or like this on our CentOS 6.2 KVM host command line:

CentOS 6.2 KVM Host:

virsh --connect qemu:///system

start vm10

quit

Afterwards, you can connect to the guest again with virt-manager and configure the guest. If you install OpenSSH (package openssh-server) in the guest, you can connect to it with an SSH client (such as PuTTY).

Share this page:

2 Comment(s)

Add comment

Comments

From: Josh at: 2012-04-11 15:47:36

Why is it that many tutorials always start out to the effect of, "First, disable SELinux.  I don't know if it works with SELinux, but to avoid problems..."

As you're doing the technical work to prepare a tutorial, you should always leave SELinux enabled... if, and only if, you encounter a problem that would take you a long time to work through, then you disable SELinux.

I just installed C6.2 on a laptop, and I've installed a handful of KVM virtual machines through the GUI interface.  Not once did I have to tweak SELinux, and not once did I get an error related to SELinux disagreements with KVM.  The management tools - at least the GUI based tools - should handle that for you.

From: Arjan Groenemeijer at: 2012-04-11 06:11:45

It's silly to disable selinux for no reason, especially on a a server. 
Libvirtd  works fine with selinux out of the box.  I hope your next article will be on selinux tricks, just to even things out ...