0xc4d4

A Simple Website running on Raspberry Pi!

written by 0xC4D4 on 2018-02-17

So I have an old Raspberry Pi that's been sitting in a drawer for a couple of years.

I want to try out some simple website, a static set of pages, but preferably with something that helps manage pages / partials and style, in a CMS kind of way. But without dynamic page generation, i want to deploy the site simple on the Pi, or any hosting provider without having to worry about database installs, CMS installs and all the updates and security patching that goes with it.

Setting up the Pi

I downloaded RASPBIAN STRETCH LITE from here (file: 2017-11-29-raspbian-stretch-lite.img )

Then I wrote to an SD-Card with dd command via the Installation Guide and following the Mac "command line" instructions on my old second hand 2011 macbook air

When the Pi is booted, the image will re-size itself to use all of the free space on the SD Card (my card was 4GB), then it will restart itself.

You can log-in to the Pi with user = pi and password = raspberry

Getting a simple static web-site generator

I had a look at a couple of static website managers, focusing on python which is supported on the Pi out of the box.

I had a little trouble with them and didn't spend much time trying to resolve until I found Lektor which was the first one I saw that also boasted a CMS-like interface - very cool!

First I got some of the python bits

sudo apt-get install python python-dev python-pip

Then I got a few more as the PIP install of Lektor was failing with a reference unfound : c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory

sudo apt-get install libssl-dev build-essential libffi-dev

I'd read somewhere that using virtualenv in Python can be a good idea as it supports you to have various versions of packages installed on your system that don't interfere with each other, so now that we had installed the python-pip package manager I went and got it and

mkdir ~/dev-web
mkdir ~/dev-web/lektor-0xc4d4
cd    ~/dev-web/lektor-0xc4d4

virtualenv .
source bin/activate
pip install --upgrade pip
pip install lektor

lektor quickstart

For the lektor install, I chose > Add Basic Blog [Y/n]: y and then was able to spin up the test/edit server for the CMS type interface and get editing right away !

cd <project name>
lektor server -p 5000 -h <the Raspberry Pi's ip address :D>

And there you go, a python based, CMS interface supported website on Raspberry Pi, come back later when I have more info on publishing the site with lektor and serving up the static output on your pi.