Rick Hurst Web Developer in Bristol, UK

Menu

Rasberry Pi as low power office server

raspberry pi running as low power office server

Part of a system that I look after for a small distribution company includes a linux server based in their offices. The server doesn’t do much – it runs a few cron jobs and a mySQL database, acting as a monitoring system on the internal network and as a middle-man receiving data extracted from Sage Line 50 database on a windows server and posting off data updates to a web-based server. It is however a vital part of the system, and needs to be running 24/7. For years this has been handled by an assortment of dusty old desktop PC’s, the last of which was starting to show signs of needing to be retired. The next old PC in line turned out to have a faulty network port, so I though it might be time to buy some kit specifically for this job. It occured to me that due to the low power requirements, a Rasberry Pi might be ideal.

Being fairly new to the Rasberry Pi, I ordered a starter kit including a Model B Pi, a 4GB SD card with “noobs” installed on it, a case and a power supply. Connected up to the TV at home via an HDMI cable, it booted into noobs, from where I installed raspbian linux. Once raspbian was installed, I found that I could install everything I needed (mysql, PHP5, apache) using apt much as I would on a regular debian-based linux box. One thing that I found I couldn’t do (from googling rather than actually trying) was install dropbox, however this wasn’t essential.

After installing it in the office and monitoring it for a few days, it seems to be coping extremely well. There is one particular php/mysql task that sends the cpu temporarily very high, but I think this can be tamed with a bit of code optimisation. I also wish I had started with a bigger SD card, as there is only just enough “disk” space when everything is installed.

One advantage of this low-power system is that I have it running from a USB cable plugged into another server rather then requiring another port on the office UPS. I’ve considered having it run from a rechargeable USB power pack, kind of like a mini dedicated UPS. I’ll be interested to see how it stands up to this kind of use. Due to the low cost of this system, the plan is to have a spare Rasberry Pi or two and some spare cloned SD cards on standby.

One other thing to note is that to plug the Pi into a monitor you may need an HDMI to DVI cable, unless you have a monitor with an HDMI port, or some HDMI or RCA to VGA solution (that will be another blog post). I only needed to plug it into a monitor to congure the static IP address – after that I ssh’ed into it from another machine.

So why didn’t I just use a virtual machine? A couple of reasons: firstly, one of the tasks for this machine is to monitor the windows server from which the sage line 50 data is sent. Secondly, the aforementioned windows server is the only machine on the network running 24/7 and already struggles a fair amount, and I didn’t want to hog any more RAM or cpu with a virtual machine.

Update 2014-01-22: The Pi has been up and running for nearly a week with no issues, but i’ve been reading about SD card wear that can occur if the disc is being written to frequently, so I plan to move the MySql and log file storage to an external drive, otherwise I suspect the card might “wear out” fairly quickly.