Old Man and the C [#|++]

Perspectives from growing up in the information age

Arch Linux on a new VPS, Part 2

In my previous post, I talked a bit about my hosting company and the Linux distribution I use for my servers.  In this post, I’ll share some details you should know before using Arch on a VPS.

First, it’s important to know that there are several ways for a hosting company to split a single physical server into multiple virtual machines.  While the goal is the same – to share one server’s resources across many VMs – the differences are important, particularly for a rolling-release distribution like Arch.

The first type is a true virtualization product, like Xen, VMWare, and Hyper-V. These products partition a server into several distinct VMs that are completely isolated from one-another.  Because each VM is a “real” server from the software’s perspective, nothing special needs to be done to make an operating system work.  Typically, there are special drivers available to increase the VM’s performance but they are not required if you’re just getting things installed and running.

The other type is more like a container than a true virtual machine, OpenVZ being the most common example.  In this type, all VMs share the same kernel and require some modification to work in the virtual environment.  While the lack of isolation and the sharing of resources might sound like a bad idea, there is one huge up-side:  performance.  The speed of an OpenVZ VM is very close to a physical server, and each can share some of the unused resources from other VMs on the same server.

BuyVM uses OpenVZ, which is how they can offer 512MB of dedicated memory and a “burst” amount of 1024MB.  Your VM is guaranteed to see at least 512MB of RAM at any given time, but it could actually have more available if others are not using it.  I knew that Arch Linux would need to have a special kernel and core library (glibc) in order to work properly in an OpenVZ environment, so I was worried that I would be building my own packages.  However, like everything else in this distribution, the community has already solved the problem.

The first thing to do is to update the system’s packages.  This is normally done by issuing the command:

pacman -Syu

However, this will update glibc with the current mainline distribution’s version, breaking the server.  If you do this, you will start getting a lot of console messages that say:

Fatal:  kernel too old

So, to solve this issue, you need to edit the pacman configuration file (/etc/pacman.conf) and add the following two lines above the section labelled “[core]“:

[glibc-vps]
Server = http://dev.archlinux.org/~ibiru/openvz/glibc-vps/i686

Save the file, and then run the “pacman -Syu” command as root.  The first thing the installer will ask you is if you want to update pacman itself before doing anything else.  Say no for the moment, we’ll get to that next.  After answering no to pacman, all of the packages will be downloaded and updated and the most current version of the OpenVZ glibc will be installed.

Next, we should update pacman so that it stops bothering us every time we install something.  To do this, simply run the following command:

pacman -S pacman

After it downloads and installs, we need to update its configuration file so that it never automatically updates glibc as part of a dependency of another application.  To do this, edit pacman’s configuration file again and look for the line that says “IgnorePkg”.  Add glibc to the ignore list:

# Pacman won’t upgrade packages listed in IgnorePkg
IgnorePkg = glibc

That’s it!  From this point we have a current Arch release running on a fast VM for $6/month.  It’s a great deal, and a terrific learning experience.  From here, I’d suggest looking at some of the other installation documents for setting up a web server, a database server, and perhaps PHP or Ruby on Rails.  I’ve got some links below to get you started.

Thanks for reading!

 

Arch on OpenVPS:  https://wiki.archlinux.org/index.php/VPS_Repo

Securing SSH with sshguard:  https://wiki.archlinux.org/index.php/Sshguard

Installing the lighttpd web server (and PHP / Ruby):  https://wiki.archlinux.org/index.php/Lighttpd

Installing mysql:  https://wiki.archlinux.org/index.php/MySQL

Arch Linux on a new VPS

I recently bought a new virtual server to host my domains on, since my previous server did not provide enough storage space or RAM to support the projects I was hosting on it.  I bought the new server from a company named BuyVM and chose the 512MB/2-core VPS.  For $6 per month, it’s hard to go wrong!

I like using Linux to host my sites and web services.  In my opinion, it’s easier to secure a Linux server from attacks than it is to secure a Windows Server 2008 machine.  That’s not to say that Server 2008 is inherently insecure, it’s just that it requires a lot more knowledge and diligence than many people realize.  Linux also has the advantage of abundant online documentation and support forums to help out when something goes wrong.

I’ve used quite a few Linux distributions in my time, starting with Red Hat in the 90′s to Gentoo in the early 2000′s.  I started using Arch Linux around 2003, and have never looked back.  Between the simple design of the distribution and the quality of its software installer (“pacman”) it does everything I need without a bunch of cruft to get in my way.  Arch is one of the so-called “rolling release” distributions, which means there is no version number; the packages available are updated as they are released so everything is always current.  There is a great installation guide and lots of package documentation available for Arch at theArch Linux Wiki.

Fortunately, BuyVM offers Arch Linux as one of the supported operating systems that can be pre-installed in a Virtual Server.  My next post will discuss the details you need to know if you choose Arch for your next virtual server.

Thanks for reading!