The Smallest Habari Server
I acquired a Pogoplug device awhile back, and on the whole I find it a neat little gadget. The user interface is okay, but not great; but really I don’t need another web-based storage location. I’ve already got Dropbox and Ubuntu One accounts that I hardly use, so being able to store more data online – albeit on hardware I control – just isn’t that useful. What I would like, though, is a small, low-power Linux server that I can use for a variety of useful tasks.
The Pogoplug has 256 megabytes of RAM, so anything I might do with it needs to have minimal system requirements. I decided to try to install Habari, mostly just to see if I could. Habari can use SQLite as its datastore rather than a complex relational database server, and requires only an http process that can handle PHP. This means it can use lighttpd or nginx rather than Apache. Using SQLite severely restricts the potential performance and scalability of Habari, but with only 256MB RAM I’m already severely limited in how much I might be able to scale.
It was trivially easy to install Debian on the Pogoplug device. I booted from a USB stick which contains the root filesystem. I added a 500GB external drive, and gave it three partitions: swap, /var and /home. The Debian install had basically no services running other than sshd – no syslog, no cups, no avahi, no nothing. I installed nginx and PHP. In order to get nginx to handle the PHP processes, I needed to install the spawn-fcgi package.
Then I just followed the Habari nginx instructions, and I had a blog running! With nginx, spawn-fcgi and a screen session connected to IRC, I still have 7 megs of unused memory, and I haven’t dipped into swap at all!
skippy@debian:~$ free -m total used free shared buffers cached Mem: 249 242 7 0 11 205 -/+ buffers/cache: 25 224 Swap: 2047 0 2047 skippy@debian:~$ vmstat -a procs ———–memory———- —swap– —–io—- -system– —-cpu—- r b swpd free inact active si so bi bo in cs us sy id wa 0 0 0 7328 197228 37972 0 0 0 25 36 39 0 0 99 0
Of course this little blog isn’t actually handling any traffic, but it’s nice to know that I have a self-contained, self-hosted Habari environment on which I can hack.