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.

linux on my old laptop – finally useful

When I first started this blog years ago I was detailing various (mostly failed) experiments with running linux on an old Time (Fic A430) laptop of mine. The machine is long past it’s prime – screen doesn’t work, no battery and was last in service as a windows 2000 mp3 jukebox at work until the harddrive failed. I decided to get a new bargain harddrive for it and have one last stab at milking some life out of it. I installed Ubuntu linux, which went on like a dream, recognising everything including onboard soundcard which always used to be a problem and the machine is now happily (and quietly) sitting at home as a general email/ web machine (plugged into external monitor, keyboard etc) and also functions as a backup server – taking nightly backups of a few remote mysql databases I have, and an ssh gateway to my home network. If this proves to be reliable, then I will feel much better about the stupid amount of money I spent on it seven years ago!

Recent windows update “monkeys” with Plone as service

A bit of an exaggeration maybe, but I thought I would blog this just in case anyone encounters the same problem. A client phoned yesterday to say that his Plone (2.0.5 on W2K3 server) intranet wasn’t working and could see that the python/zope service was not starting. As it had been running fine for months previously (albeit a bit of memory leakage), my first question was if anything had changed on the server. Other than windows updates, nothing had changed. Not being a windows expert and having burnt through hours trying to resolve a previous plone issue on their old windows server, I threatened to go over there and install vmware and give him a virtual machine running linux or FreeBSD to run the Plone intranet on. At that moment, the unix-phobic client spotted that where he had previously set the IIS https/ssl service to manual startup, the recent updates had reset it to automatic. This was stopping Zope binding to one of the ports (or something like that), hence the service failing on startup.

This was a fairly obscure, but it just goes to show that sometimes the mere mention of unix can sometimes solve windows problems 🙂

archived comments

Of course it monkeys with Plone! Plone is one of those software projects that makes Microsoft executives wet their pants!

Yaro 2008-07-24 18:46:56

transplanting a linux setup

I was amazed to hear that it is possible to move a disk with an ubuntu (and probably other) linux install on it from one machine to another (different type of) machine and it will still work. Possible spanners in the works are the graphics card (which may need reconfiguring) and network connections which are hooked up to the linux install according to mac address. I tried it this evening – moved a disk and network card from one machine to another and I instantly had a working box that I could ssh in to, although needed some work to get the graphics card recognised (won’t go into that here, but CTRL – ALT and backspace is handy for restarting
x-server).

unix command to delete the .svn folders

This command will delete all those pesky .svn directories that have been left by subversion:-

find ./ -name ".svn" | xargs rm -Rf
(obviously you will want to keep the .svn folders if you are still using subversion!)

archived comments

Or a slightly safer version:

find . -name “.svn” -print0 | xargs -0 rm -Rf

(those are zeros, not ohs, if your font shows them ambigiously)

This is slightly safer as is used a null byte () as the delimiter between entries, rather than a space. This means that if I happen to have a folder called “foo” and one with spaces in called “foo bar”, you might find a .svn dir present in “foo bar” will cause the whole of the “foo” directory to be deleted.

-Matt

Matt 2006-10-17 15:16:24

Thanks a bunch for this… Looking for an easy way to remove the .svn dirs without having to go to each directory. Saved me some serious time.

Craig 2007-01-09 14:57:16

Thanks a thousand. You too, Matt.

Braden 2007-03-06 22:18:23

I use this to delete temp mac osx files

find . -name “._*” -print0 | xargs -0 rm -Rf

handy to run before uploading a project via ftp.

Tim 2009-02-28 04:53:01

Depending on the situation, you might be able to just use the ‘svn export’ to check out a clean tree?

Tom 2010-03-06 10:54:19

return of the mac

i’ve now gone full circle and am using my powerbook (plus second monitor, keyboard, mouse etc) as my main work machine. The windows laptop now sits on the edge of the desk so I can reach over for IE testing. Using windows as my main machine drove me mad. unexplained freezes, random system tray frenzied disco icon action, “insufficient ram” messages, despite me having over a gig of it and only using about 200mb of it. Flakiness.
Being back on the mac feels lovely, even if I do have to skate a couple of miles with it in my backpack to get it here. The battery now only gives me about 30mins – new one on order (wait, did I already blog that?).

Someone else here is using an intel mac mini with a stack of ram and parallels for windows testing. works a treat. need to distract them and steal it!

archived comments

I have new 24inch Intel Core2Duo Mac. Supersize me! Not about to skateboard it anywhere though. 🙂 Your old PC will gradually get shoved further along the desk and have phoned books stacked on it 🙂

Have you looked at SightSpeed as alternative to Skype ? I’m only on dial up but I can see it produces a far superior pic through the built in iSight camera. Video is a nonsense on dial up though.

I’ve been making use of mpeg Streamclip to convert stuff – brilliant little program and a freebie.
http://www.squared5.com/

Judith Hall 2006-12-18 06:40:26

ubuntu update kills vmware server

After applying a whole load of ubuntu updates, vmware server console wouldn’t work – it would try to start then just quit with no error message. After a quick msn chat with netsight linux guru scott (in foreground), It turns out that one of the updates I had applied was a kernel update. to fix vmware I needed to download the new kernel headers:

# aptitude install linux-headers-`uname -r`

then run the vmware server config again:

# sudo ./vmware-config.pl

I accepted all the defaults, and now it is working fine again 🙂

archived comments

Thanks for this solution… it made my day!
(http://www.rickhurst.co.uk/2006/09/20/ubuntu-update-kills-vmware-server/)

/johnny

johnny niska 2006-10-28 18:04:20

ubuntu on HP nx6110

I needed to reinstall windows on my work laptop as it was getting a bit sketchy and unreliable in that undefinable way, so I took the opportunity to repartition the disk and set it up as a dual boot machine, with ubuntu. I created a primary 15gb partition for windows and installed win xp in the usual way, then used the partitioning tools in ubuntu to create a 15gb partition for data (Ext3 to be shared between windows and linux, by installing these ext3 drivers in windows), and a 6gb partion for the ubuntu install. It all went fine, but the wireless card isn’t recognised by ubuntu. I’ve looked into it – apparently I can get it working using some windows driver voodoo that goes by the name of ndiswrapper. I haven’t tested how/if ubuntu handles sleep and dual monitors yet, but will do at some point.

archived comments

Did you ever get the Wi-Fi card to work?

Thanks!

Aris 2007-05-14 19:41:42

Yes I did, or rather I got someone else to get it to work – they had to download some firmware I think? I suspect a more recent version of ubuntu might make this easier as it allows you to install proprietary drivers, and the network select dailogue thing is working

Rick 2007-05-14 20:07:39

bulk search and replace on unix using perl

here’s a example of how you might do a bulk search and replace on unix – here i’m replacing all occurences of old style br tags with xhtml br tags:

perl -pi -e ‘s@<br>@<br />@g’ * (this will replace all instances in all files in the current directory)

find . -type f | xargs perl -pi -e ‘s@<br>@<br />@g’ (this version will search subdirectories too)

EDIT: remember that bulk search and replace can be dangerous, and also bear in mind that if you use subversion like we do, the method described above will affect the .svn files too. This appears to be a BAD THING

Platform Agnostic

For the past few months i’ve been using mainly windows for web development, because I seem to find myself doing a lot of testing in IE, and I was fed up of lugging my powerbook to and from work (on a skateboard), so I nagged netsight into buying me a cheap laptop to use here and to take on client visits. Set up on an iCurve stand with a second monitor it has proved to be a nice little set-up. One thing I have noticed is that it gets into a panic if you do something such as unplugging a cable at the wrong time and I do find myself rebooting quite often compared to my mac. It is nowhere near as portable and robust as the powerbook. Always paranoid of the viruses too..

At home i’ve ended up running ubuntu linux with windows running as a virtual machine in the excellent and FREE vmware server. The powerbook will shortly be married to an apple studio display as a living-room friendly multimedia machine and workstation. I have probably spent an unhealthy amount of time getting myself in a situation where I can do everything from every machine – using putty in windows to develop on the linux and osx machines, vnc, terminal services, shared folders. I justify this because I am after all a developer and I have my reasons for using all these setups. If I wasn’t a developer I would just stick with the powerbook.