CentOS 7 Web Host Upgrade Complete!

Originally published 2014-07-16 15:55:41 by Nathan England
related tags: centos, kvm, linux, vps server, web hosting,

Out With the Old, In With the New

As I have stated in other articles, I am a big fan of using KVM to host multiple guest servers on a single primary server. I'm also a big fan of CentOS for linux servers. All of my KVM guest virtual machines currently run CentOS 6.5 x86. In my experience I have found that 32-bit virtual machines outperform 64-bit virtual machines, at least in my usage. I don't have any databases with large enough requirements to utilize a 64-bit OS and if I did, I probably wouldn't put it on a virtual machine anyway. For general LAMP usage, 32-bit virtual machines are top notch.

All of those 32-bit virtual machines need to run on a host server, so what do you pick for that? The physical machine I use for hosting my virtual machines is a quad-core AMD with 16 GB of ram. I have a USB 3 external backup drive connected to store the daily backups from the raid array in the server. You can never have too much backup! The 6.5 version of CentOS only sees my USB 3 hard drive as a USB 2 device, and the backup speeds match accordingly. So, wanting to get every ounce of speed out of the machine as I can, I went against my preference of CentOS and I use a recent version of Ubuntu server. It has a new enough Linux kernel to fully recognize and support my backup system. Not only that, having a new version of the kernel also means I have a newer version of KVM so even my virtual machines benefit.

A few weeks ago Red Hat released Red Hat Enterprise Linux 7.0 which has the latest and greatest of everything, that an enterprise data center would want, and that means a well supported recent Linux kernel and a newer version of the KVM stack as well! Finally, my prefered server distro will support my needs! I patiently waited for CentOS to catch up and release version 7.0. As of today, they have only released version 7.0 for X86_64 systems, which is all I want at the moment. So I downloaded the iso file and burned it to a dvd while backing up my libvirt configuration files and the KVM images. I also use the host server as a Samba server for local file shares on all my workstations, so I manually executed the backup script to copy all of my data to that USB 3 drive at lightning speed!

Moments later, I had a display connected to my AMD box and was busily formatting the raid array and installing CentOS 7. In my giddy excitement I forgot to note what time I started the whole process, but I really doubt it took more than 20 minutes to install. After booting the CentOS iso one of the installation options was for KVM Host, so that is what I chose to install. Everything else I need I will install later with yum.

Once the installation was completed, rebooted, and waiting for me at the prompt, I logged in and ran yum update, which spooled along a bunch of new updates and then was ready to go. I plugged in my USB 3 device and mounted the volume in a new directory called /ext-backup... how original.

This host machine will also handle DNS internally for all of my development sites as well as DHCP for all my workstations, test machines, and my virtual machines. I copied the required DNS and DHCP config files from my Ubuntu backup and made the necessary changes to each, put them in place and started the services. I was ready to begin the restoration...

FTL Engaged, sir...

I like to use the mc (midnight commander) shell for file copying on the command line. It is usually one of the first utilities I install. I fired it up and navigated to my external backup of my libvirt virtual machine images and copied each of them over to their new locations. On previous CentOS this would have required many many hours at USB 2.0 speeds. Instead, at USB 3 speeds, the system copied 188GB of virtual machine image goodness in less than 30 minutes and I was ready to move on to the next step, configuration!

I use virt-manager on my workstation to remotely administer my virtual machines. I noted down all the network MAC addresses needed for each virtual machine, so they would pick up the correct IP from the server and I began creating new virtual machines, assigning the existing image to the appropriate virtual machine, and entered the MAC as well. Upon completion of each domain the virtual machine started and I was immediately able to navigate to the hosted sites of each domain on that virtual machine. How awesome is that!

I have a dedicated virtual machine for mysql, so all of my development sites will speak to that machine. Naturally, that is the first virtual machine I created. Then I use virtual machines for each client matching their requirements, as well as a virtual machine that contains all of my development projects that I tinker with, and finally a separate virtual machine for holding frameworks and testing environments that I don't want to mess with.

All said and done, because I chose to keep all of my work on virtual machines, meaning I had little to configure upon a system failure and recovery, I had everything configured and working just the way I like it in less than two hours.

What does all of this mean to you? First of all, good backups are key. If I had not had my backups none of this would have been possible. Secondly, if disaster struck and my servers went down or a hard drive failed, I could recover very quickly.

If you don't have a good backup solution, contact me! and I will help you prepare for disaster and recovery.