Installing and Running a Headless Virtualization Server

Securely Access the Virtual Machine

Now you have reached what may be considered the most important piece to the puzzle—that is, accessing the newly created virtual machine from a remote location. This is where you will connect to the running virtual machine to install, configure and use the guest operating system. The easiest way to accomplish this is by using the virt-viewer utility. Install this from your distribution's package repository, and connect to the virtual machine via SSH:


$ sudo /usr/bin/virt-viewer --connect=qemu+ssh://192.168.1.89/system
 ↪-- CentOS6.5-vm1

Note that this utility also may be launched from the Applications menu in your preferred desktop environment. Also, to toggle the keyboard and mouse capture state to/from the virtual machine, the virt-viewer defaults to the Ctrl-Alt key press.

When dealing with such technologies, security becomes an increasingly important topic, and it's advised to share public SSH keys between client nodes accessing the virtual machines on the server. This way, authentication and access can and will be limited only to authorized users and from authorized machines. Another area worth some attention is the firewall and ensuring that iptables allows access over specified ports from specified addresses, denying all else.

Figure 1. Using virt-viewer to Connect to the Virtual Machine

Connect to the virtual machine and proceed with the operating system's installation process. When completed, the installer will reboot the recently installed operating system, and the CD-ROM image will eject automatically. If you noticed that the virtual machine did not restart and you are unable to reconnect with virt-viewer, using the examples highlighted in the previous section, check that the virtual machine is running. If not, restart it. Your newly installed operating system should boot and run as if it were installed on native hardware.

Additional Notes

A virtual machine can be enabled to autostart on the host system's bootup. To accomplish this, invoke the following:


$ sudo /usr/bin/virsh autostart 1
Domain 1 marked as autostarted

List the domain's information to see this option now enabled:


$ sudo /usr/bin/virsh dominfo 1

[ ... ]
Autostart:      enable
[ ... ]

To disable it, type:


$ sudo /usr/bin/virsh autostart --disable 1
Domain 1 unmarked as autostarted

Summary

Whether you are running multiple hosted services or virtual clients on limited hardware, or taking advantage of an isolated development environment, hardware virtualization has shown that it is capable of many great things. Run one or more virtual machines on a single server or on multiple servers within a cluster and with high availability enabled. There is no limit to what can be accomplished with few and sometimes limited limited hardware resources.

Resources

______________________

Petros Koutoupis is a software developer at IBM for its Cloud Object Storage division (formerly Cleversafe). He is also the creator and maintainer of the RapidDisk Project. Petros has worked in the data storage industry for more than a decade.