Webserver Mk II (Raspberry Pi)

I've been keeping a gentle eye on this cheap and very cheerful device while letting two of my chums burn their programming digits on it. So when the power supply of my Asus Eee PC failed, and when it had already proved not quite big enough to shoehorn the latest level of Ubuntu Server on to (to run Apache), and when Brian quickly cut me a slice of the latest Raspberry Pi Debian build and added the extremely lightweight web server Lighttpd, demonstrating how very quickly it served a local copy of the 'molehole' site from its SD card, what was I to do?

Naturally, I caved — and asked him to order one for me. No screen needed. No keyboard needed. Just a power supply, a network cable, and an 8GB SD card. Not quite small enough to fit in a tin of Altoids. It amuses me to have an ARM-based machine once again.

New server

And it seems entirely fitting to display the device with a few coins (for scale). This particular specimen was one I had on loan from Len, loaded with 'molehole' files on the 8GB SD card I had on loan from Brian. (Just as a proof of concept.) The "real thing", identically housed and configured, is now upstairs running live on my internal network as a seamless replacement for its predecessor. It's at the same IP address so I merely had to tell my router its MAC address.

In Brian's words:

Tonight I took that formatted SD card, installed Raspbian (Raspberry
Pi's own flavour of Debian) which was trivial. I updated it to all the
latest packages and installed lighttpd which installed first time with
no problem. Reconfigured the lighttpd.conf file in light of this
afternoon's discovery re mod_ssi and mod_compress, copied ~david to
the /var/www folder and browsing to IP address/~david works a treat
including SSIs. Everything took less than an hour including downloads,
updates etc. and worked with zero problem or effort.

I've also installed unattended-upgrades but I need to let the box run
for a while to test that since I already manually upgraded all the
packages to the latest as part of the install process.

What I need from you is a static IP address and I think we are done! I
have installed vsftpd so you have ftp access for winscp although that
may need configuring chez vous to ensure all is working; ssh was
configured as part of the orginal installation configuration.

BTW, the 8GB hard drive is partitioned 570Mb for boot and kernel and
the remaining 7.3GB (yes I know that doesn't add up to 8GB but it is
what the disk space command shows) which is the entire Raspian System
and all user files (currently just the contents of ~david) currently
takes up 2.7GB leaving 4.3GB (again I can add up) for future user
files and other system packages. In short, loadsaspace.

All this in a silent, tiny PC ("Overall real world performance is something like a 300MHz Pentium 2, only with much, much swankier graphics.") Faced with the simple load presented by my largely static1 web pages, and running a very slick little webserver, it's serving pages in fractions of a second. Cool!

For future reference

It's a doddle to update the Raspian-flavoured Linux. I did so in January 2013 and picked up about 214MB of upgraded modules, plus a new build of the web server. I just used 'putty' as my terminal command prompt interface from BlackBeast to log on to "pi" (imaginative, right?) followed by:

'sudo apt-get update'
'sudo apt-get upgrade'

If I read it right, only eight packages were not upgraded. It caught up with lighttpd fixes on the way, stopping the web server, unpacking replacement code and then restarting the server at "1.4.31-3" all without any intervention on my part. When it had finished, I did a Sudo reboot and everything was back on the air after a total of perhaps 20 minutes.

Webserver Mk IIa (Raspberry Pi2)

Almost all the above still applies, but (as of 9 February 2015) the new RPi2 does everything about 6x faster. It also has 1GB of RAM and now holds all my internal 'molehole' files on a 16GB microSD card. Neat! Updating the little chap (now once again relocated upstairs in Junior's room to free up a Gigabit network port downstairs that it can't fully exploit) is — from BlackBeast Mk III's Linux POV — even "trivialler". Just type

ssh pi@

from a BlackBeast terminal prompt, login to the Pi2, and then do the same two bits of apt-get magic. Last done, in fact, on 22nd May 2015. And 16th September 2015. And 30th May 2016. And 14th September 2016.

Autumn 2016 news

At some point in 2016 I fitted a second 8-port switch down in the living room, so I once again have this Pi2 nearly underfoot down here. It's also no longer having to contend with any SSIs as my entire website now consists of simple static HTML files. There was no point in continuing to use SSIs on my internal pages when all my external pages on AWS had migrated to pure HTML. The Pi2 is plenty fast enough for what I ask of it, so my new (even faster) Pi3 will just have to find something else to do. Kodi, perhaps?


1  Only "largely static" because I use four Server Side Includes on each 'molehole' web page (for my lazy convenience).