Installing and Running a Headless Virtualization Server
In recent years, hardware virtualization has become commonplace in the computing industry and more available to end users. The idea behind it is a noble one. Why invest in allocating more server hardware and not utilize it to its full potential, when instead you can consolidate it all onto one or a few servers and share their resources?
In this article, I focus on full hardware virtualization. This refers to the creation of a virtual machine with enough simulated hardware to act like a real computer with its own operating system. In turn, this virtual machine, or virtual guest, is enabled and running on top of a host machine. The software that controls virtualization is called the hypervisor. The hypervisor runs on the host machine.
Virtualization typically is used to consolidate hardware servers, reduce energy consumption, simplify server management and ease migration/recovery (in the situation of a failure). It sometimes is accomplished with hardware that needs to be accessed remotely, as the hardware may reside in what may not be a local data center. With that in mind, the hardware's operating system also may be configured without a graphical environment (meaning one that also includes a lack of attached monitor and input devices). This commonly is referred to as running headless. This article assumes that you have Secure Shell or SSH access to what will become the host machine.
Prior to configuring the virtual machines, install the appropriate packages from your distribution's package repository. These packages include the libvirt library that provides a simple virtualization API, client-side utilities to access the library and manage the virtual machines, a Python virtual machine installer utility and the userspace components to the kernel-based virtual machine (KVM).
Note: libvirt is an open-source API, dæmon and management utility for managing platform virtualization. KVM is a virtualization infrastructure that turns the Linux kernel into a hypervisor. It requires a processor with hardware virtualization extensions.
Depending on your distribution, the package names may differ. On Red Hat/CentOS, they are labeled as libvirt, libvirt-client, python-virtinst and qemu-kvm. On Debian/Ubuntu, they are labeled as libvirt, libvirt-bin, python-virtinst and qemu-kvm.
Enable the libvirt dæmon to run on all appropriate runlevels at system boot up and manually start the service:
$ sudo /sbin/chkconfig libvirtd on $ sudo /sbin/service libvirtd start Starting libvirtd daemon: [ OK ]
View the status of the dæmon and validate that it is running:
$ sudo /sbin/service libvirtd status libvirtd (pid 2482) is running...
When the libvirt package is installed, /var/lib/libvirt/ is used as the default location for all virtual machines and related files. If you prefer to relocate this to a more redundant and sometimes external piece of storage hardware, you are welcome to do so. However, for this article, I'm going to continue with the default and place the operating system's installation ISO image in the /var/lib/libvirt/boot/ directory path.
Installing a Virtual Machine
Before beginning, view the list of locally installed virtual machines. Assuming that this is following a fresh installation, there shouldn't be any listed:
$ sudo /usr/bin/virsh list --all Id Name State ----------------------------------------------------
With libvirt, virtual machines are defined by a specially formatted
XML file. You can read more on this XML format at the libvirt project
site. Fortunately enough, you don't have to touch the XML code and
can rely on
virt-install utility is used to provision
new virtual machines and reduce most if not all complications.
For instance, if you want to define a new virtual machine named CentOS6.5-vm1 with one virtual CPU, 512MB of RAM and so on, you can do so in the following way:
$ sudo /usr/sbin/virt-install \ > --name CentOS6.5-vm1 \ > --description "CentOS 6.5 64 bit VM1" \ > --ram=512 \ > --vcpus=1 \ > --cpu host \ > --hvm \ > --disk path=/var/lib/libvirt/images/centos6.5-vm1,size=3 \ > --cdrom /var/lib/libvirt/boot/CentOS-6.5-x86_64-minimal.iso \ > --graphics vnc Starting install... Allocating 'centos6.5-vm1' | 3.0 GB 00:00 Creating domain... | 0 B 00:00 Cannot open display: Run 'virt-viewer --help' to see a full list of available command line options. Domain installation still in progress. You can reconnect to the console to complete the installation process.
--cpu host option optimizes the CPU properties for the VM by exposing
the host's CPU's configuration to the guest, while the
requests the library for the use of full hardware virtualization. The
--cdrom option points to the installer disc image,
gives the name (with absolute location) and size (in gigabytes) of the virtual
--graphics option allows VNC access to the virtual machine,
which will be utilized later in this article. Other supported options
include network configuration, boot priorities and more.
Petros Koutoupis is currently a senior software developer at Cleversafe, an IBM Company. He is also the creator and maintainer of the RapidDisk Project. Petros has worked in the data storage industry for more than a decade.
|Graph Any Data with Cacti!||Apr 27, 2017|
|Be Kind, Buffer!||Apr 26, 2017|
|Preparing Data for Machine Learning||Apr 25, 2017|
|openHAB||Apr 24, 2017|
|Omesh Tickoo and Ravi Iyer's Making Sense of Sensors (Apress)||Apr 21, 2017|
|Low Power Wireless: 6LoWPAN, IEEE802.15.4 and the Raspberry Pi||Apr 20, 2017|
- Graph Any Data with Cacti!
- Teradici's Cloud Access Platform: "Plug & Play" Cloud for the Enterprise
- The Weather Outside Is Frightful (Or Is It?)
- Simple Server Hardening
- Understanding Firewalld in Multi-Zone Configurations
- Preparing Data for Machine Learning
- Server Technology's HDOT Alt-Phase Switched POPS PDU
- Gordon H. Williams' Making Things Smart (Maker Media, Inc.)
- IGEL Universal Desktop Converter
Pick up any e-commerce web or mobile app today, and you’ll be holding a mashup of interconnected applications and services from a variety of different providers. For instance, when you connect to Amazon’s e-commerce app, cookies, tags and pixels that are monitored by solutions like Exact Target, BazaarVoice, Bing, Shopzilla, Liveramp and Google Tag Manager track every action you take. You’re presented with special offers and coupons based on your viewing and buying patterns. If you find something you want for your birthday, a third party manages your wish list, which you can share through multiple social- media outlets or email to a friend. When you select something to buy, you find yourself presented with similar items as kind suggestions. And when you finally check out, you’re offered the ability to pay with promo codes, gifts cards, PayPal or a variety of credit cards.Get the Guide