Overworking Your Raspberry Pi Home Server

Overworking Your Raspberry Pi Home Server

(Note: I wrote this back in March, but forgot to actually publish it until December. Oops)

About six months ago, I replaced my bulky hand-me-down Dell desktop with a Raspberry Pi 2 for server duties (the desktop duties were transferred to a new HP Pavilion Mini, nicknamed The Cereal Bowl, both for its likeness, as well as ability to fit inside one). The immediate benefit was a roughly 99% reduction in size, at least a double-digit percentage in reduced power consumption, and a 100% reduction in noise. So far, it's admirably handled all the crazy stuff I've thrown at it. This isn't really a "how-to", but more of a "what-to", for those of you needing some ideas for things to do with your petite server.

Web Server

This is kind of the obvious one; this site is hosted on the Pi in question, after all. Granted, the Pi isn't really a monster server, so I've chosen Pelican for the backend platform. Pelican is what's known as a static site generator; you create all your content, styling, configs, etc., feed it all through a bunch of Python scripts with a nice Makefile, and a whole site pops out as pre-generated HTML. This means individual page requests don't involve any server-side code or database, and you get a site with almost no attack surface area. Can't do much SQL injection when there's no SQL to begin with, right?

I also have a 64 GB flash drive plugged in to hold a web site that's a roughly 15 GB collection of PDF documentation, so I can pull these up from anywhere inside or outside the house. Keeping it off the root filesystem helps reduce the size of SD card backups.

DNS Server

I like to be able to have nice hostnames for stuff on our LAN: printer, hpmini, and so on. There are a couple ways to accomplish this; you can use dnsmasq as a caching DNS server, and also have it serve up records from the Pi's hosts file.

The other alternative is to use the full-blown bind DNS server, which honestly isn't nearly as complicated as its reputation suggests. It's nothing compared to the mind-flaying insanity of sendmail.cf. If you're familiar with DNS server concepts, it isn't that hard to set up and manage. But if you don't know what CNAMEs or black-hole zones are, or why you might need them, you're probably fine doing this with dnsmasq.

As a nice bonus, if you're using bind, your reverse lookup zones make a decent poor-man's IP address database.


If you've got a Linux server, then you've got an SSH host for tinkering around in the shell, right? This one kind of goes without saying.

Git Remote

The cool thing about Git is that it works over plain SSH connections, so using your Pi as a remote is as simple as deciding where you want to store the repos. I stuff them all in a "git" directory inside my home directory. Note that you'll have a bit more legwork here if you want publically accessible Git repos, as SSH access requires an account on the system. But in that case, it's probably easier to just add a second remote to push your public stuff to Github.

Airprint Server

Back around iOS 4, Apple added Airprint, allowing iPhones and iPads to print wirelessly to supported printers. Our printer (a Brother HL-5250DN) predates Airprint by a few years, so an intermediate print server is required to get things working.

Essentially, you install cups and a few auxiliary modules, and any printers you've shared through cups will be reachable via Airprint. Note that Linux print drivers aren't always a given; I ended up having to use some generic Laserjet driver, as the recommended Postscript and BR-Script drivers would cause Ghostscript to choke on its own vomit and start spooling 1+ GB temp files when printing a simple 9-page web page.

IRC Relay

I have znc running as an IRC relay for... some reason. It's not terribly essential, and znc is kind of a pain to configure, but I get an encrypted connection to my server (the outbound connection to EFNet isn't encrypted), which is nice for use on networks that block IRC. It's also configured to cache a few thousand lines of scrollback, so I can see what's been happening when I connect, or catch up in the event that I get disconnected briefly.