Virtualization With KVM On A CentOS 6.3 Server - Page 2

5 Connecting To The Guest

Fedora 17 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 17 desktop.

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

Type in your password:

When you start virt-manager for the first time, you will most likely see the 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.3 KVM host. Click on Close and go to File > Add Connection... to connect to our CentOS 6.3 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 ( or IP address ( of the CentOS 6.3 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.3 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.3 KVM host command line:

CentOS 6.3 KVM Host:

virsh --connect qemu:///system

start vm10


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:

4 Comment(s)

Add comment


From: Dim at: 2012-08-30 19:00:45

You are missing DELAY=0 in the bridge ifcfg script. Without it an incoming migrating VM will lose several seconds of network connectivity

From: at: 2012-11-06 19:14:59

I had the following error occur and was able to fix it thanks to another site.
# virsh -c qemu:///system list
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
error: failed to connect to the hypervisor
yum -y install avahi
/etc/init.d/messagebus restart
/etc/init.d/avahi-daemon restart
/etc/init.d/libvirtd restart
/sbin/chkconfig messagebus on
/sbin/chkconfig avahi-daemon on

From: Anonymous at: 2012-11-20 05:38:08

Thanks for the great write-up. Makes for an impressive virtual lab for home or work use. 

From: Anonymous at: 2012-11-22 04:17:22

You don't have to worry about SELinux. Leave it enabled. I have centos 6.2 running with a similar sort of setup.

On the host, if you leave SELinux on, it is better. Each virtual machine will run under it's own svirt process meaning that the virtual machine is essentially block from reaching the host. This is important because it makes it much more difficult for a compromised virtual machine to act as an attack vector for the virtual host. It essentially seperates everything nicely.

See redhat admin docs, they are applicable to CentOS as well.

The documentation is not the most detailed I have ever seen, you won't get hand holding but they are good for nudging you in the right direction.