A wayward journey into the depths of sanity

Creative Commons License

Building an ArchLinux hosting box (part 1)

One of my favorite linux distros has been archlinux since the early oughts. It’s default install is super lightweight, and it’s configuration system is a joy (especially after working with several distros with many rc directories and hundreds of symlinks).

However, there is a learning curve with archlinux. Since it’s so stripped down, some things that you might expect to see are not installed or configured. And following it’s minimalist mantra, packages tend to not configure themselves when you install them. Following is blow by blow to help get a box booted up and running.

First off, you need to get the installer. archlinux used to come in one flavor (i686), which back when everyone else was running i386 was really really nice. Now days, they offer i686 (for older boxes) or x86-64 (for 64 bit boxes) Head on over and grab a netinstall. Be nice and leave your torrent running for a while. You also can grab a core cd. It’s quicker, but you might have a big update to do right after the first boot.

Pop the CD in, start the VM with the image or what have you.

You are then presented with a nice grub screen. Choose the default, and proceed.

Login as root and fire up /arch/setup. You’ll want to read the intro screen, but the main takeaway is that alt-f7 will show your stdout, should you need it.

Choose option 1 select source and then choose http/ftp. It will ask you to configure your network. Normally, you can just accept all of the defaults. If your NIC is not recognized, you’ll need to get the driver for it, and install it by hand. That has not happened to me in years however.

Once you get to the Network is configured screen you are ready to proceed onwards.


You’ll want to choose a mirror to download from. Try and make a sane choice. The archlinux.org one is throttled, so it will be rather slow. I personally like kernel.org, but your milage may vary

You’ll be prompted to set you clock next. I suggest choosing your timezone, and then setting your system clock to UTC. I normally tell it to just use NTP, and go with it after that.

Next up, the always scary hard drive partitioning. You are using a system with drives that have nothing on them, right?

Unless you have special needs, letting it have at it gives a good, solid default setup. If you need LVM, or some weird scheme, by all means, have at it.

It will want to create a /boot, swap, / and /home partition. It asks you how big you want each one, with home being the last. remember to leave some space for your home directory! It will ask you what format you want to use (ext3 for safety, ext4 for cutting edge, xfs for 200% more fun), so tell it, and proceed onwards. Once you see the magic OK button, we are good to go!

Choose return to main menu, and select packages will be highlighted for you. So that’s what you should do next. You’ll want to choose the defaults here, as the “base” package list is just that. Click on through to install, and let it go.

Take a moment to revel in the up to date packages flying past. Also take a moment to grab a frosty cold beverage of your choice. It’s going to be awhile.

Next up, configuring the system, and installing the bootloader. You might want to change the root password.

All of the above is pretty straightforward, if you ever have installed linux before.

After the system reboots, you’ll be presented with a baseline system. Not much is running, and not much is installed. We need to do some work to get the system into a useable state.

First Update:

Note: As a rolling-release distribution, updating your Arch Linux system is not always as straightforward as with other fixed-release distributions. Furthermore, pacman is not a "fire-and-forget" package manager. As a result, properly maintaining an Arch Linux system with pacman tends to confuse new users (as recurring forum discussions would indicate). Please read the following section thoroughly before continuing.

from Upgrading packages

You’ll want to run a quick update. pacman is Arch’s package manager. The basic upgrade command is pacman -Syu. You’ll want to run this to preload the package files anyways.


One of the first things that I like to install is SSH. The Archwiki has a great section on installing ssh/sshd. Basically, you will want to install the package (pacman -S openssh), edit the /etc/ssh/sshd_conf, /etc/hosts.allow and /etc/rc.conf and then start sshd using /etc/rc.d/sshd start.

You should then be able to ssh into to the box.


pacman -S sudo will get that setup. You’ll want to add what ever users need sudo access to the /etc/sudoers file.


There are a few choices here. In my mind, the better choice is Nginx, and the “safer” choice is Apache2. But, if your tastes run to the exotic, you can choose from cherokee, yaws, or several others. Mongrel2 is not packaged for Archlinux as of yet, but when it becomes stable, I’m sure it will be included.

Why Nginx?

Nginx is a light weight, fast, simple web server. It’s config files are fairly straightforward, and did I mention it’s fast? It’s best used as a front end, serving static files and balancing between several back end application servers (unicorn or passenger for Ruby, php-fpm for php, and what ever python uses these days for python.)


pacman -S --noconfirm gcc gcc-libs make kernel-headers zlib libtool bison gdb strace gettext openssl git readline to install the prerequisites for rvm and building rubies, and bash <<( curl -L http://bit.ly/rvm-install-system-wide ) for rvm system wide. You can also do bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) for a per user install. You’ll need to add source /usr/local/lib/rvm to your /etc/bash.bashrc file, and either open a new terminal window or run the source command to initialize rvm. I advise that you read up on rvm. It’s a killer tool, and if your not using it, your doing it wrong.

I then install the ruby and gems that I need (rvm install version and then gem install blarg, where blarg is a list of real gems.)

PostgreSQL (or, if you insist, MySQL)

Arch’s wiki has a really good article on PostgreSQL. It also has a great article on MySQL. Head on over after you choose your poison.

Finishing Touches

You have a solid box for hosting setup. You’ll want to harden the machine, but that’s another article…