Pi to WordPress – Part 1 : Installing Raspbian
This is part 1 of a series, documenting the setup of an out-of-the-box Raspberry Pi to a self-hosted SSL WordPress site.
I’m running this WordPress blog on a Raspberry Pi 3B, so I thought I’d document my setup process, from first boot all the way to an internet published SSL WordPress site. Hopefully it’s of use to somebody looking to do the same.
I’ll mostly be linking to the guides that helped me for each individual step, with amendments where needed; as somebody who is predominantly Windows focused, when it comes to Linux configuration I find the key is sourcing a guide that is as relevant as possible to what you are doing and following it to the word.
This guide assumes you’re setting up from a Windows PC on a basic home network with DHCP.
The steps I’ll be covering in each part:
- Installing Raspbian
- Installing WordPress
- Public IP and NAT
- Domain Name and DNS
- SSL Cert
- Is it worth self-hosting?
We’ll be using Raspbian Buster Lite on our Raspberry Pi.
You will of course first need an SD card (I’d recommend 8 GB minimum) and a way to mount the SD card onto your computer to write the Raspbian image . If your machine does not have an in-built SD card reader, I’d recommend a USB SD card reader, as they are convenient to have regardless.
Download the latest version of Raspbian Buster Lite:
Download the latest version of balenaEtcher, which you’ll use to write the Raspbian image to your SD card:
Run balenaEtcher, target the Raspbian zip you downloaded (no need to unzip), and target your mounted SD card. Click Flash to begin the write process, which should only take a few minutes.
Once the write is complete, there’s one more step before inserting it into your Raspberry Pi. By default, SSH is disabled in Raspbian Buster. If you want to connect to your Pi without the hassle of a physically connecting it to a keyboard and monitor, we need to enable SSH now. Do this by creating an empty file simply named “SSH” in the boot partition of the newly created SD image (the boot partition should appear mounted as its own drive, named “boot”). Note there is no extension to this file; the simplest way to create this file is is right-click in the boot drive, select New Text Document, name “SSH”, ensuring there is no .txt extension. You may have to untick “Hide extensions for known file types” in Folder Options to confirm this.
You’re now ready to insert the SD card into the Pi, which should be connected to your home network (I’m assuming a wired Ethernet connection, which you will want for web server reliability), and boot up. To SSH into the Pi, we’re going to have to find out what IP address it has picked up on your network. To do this, we generally have two options:
- Log into your router, go to the DHCP section, and find what address has been leased to the Pi. You should see it referenced by the default Raspberry Pi hostname, “raspberrypi”.
- If you don’t have access to your router; stop reading this and figure out how! You will need access later for essential NAT configuration. However, another way to discover your Pi’s DHCP address is to do a network scan of your local network, looking for hostname “raspberrypi”. There are plenty of tools out there, but I recommend Advanced IP Scanner ( https://www.advanced-ip-scanner.com/ ), as you can run it portable without installing. Just run the installer, click the big green Scan button, and you should see all devices with live connections to your local subnet, including our Pi:
Now that we have our Pi’s IP address, connect via your favourite SSH client, such as PuTTY, with the default credentials; user ‘pi’, password ‘raspberry’.
A few house-keeping tasks first off. Run:
which will launch the Raspberry Pi Software Configuration Tool.
We’ll want to amend the following:
- Change User Password – Self explanatory, change the default pi password.
- Network Options / Hostname – Optionally rename your Pi; this is the name that the device will appear as on your local network. Defaults to raspberrypi.
- Advanced Options / Expand Filesystem – By default, the Raspbian root file system is 2 GB. Run this to expand the file system to the capacity of your SD card.
- Advanced Options / Memory Split – Set to 16; your WordPress won’t benefit significantly from excessive GPU memory.
- Interfacing Options / SSH – Enable SSH if you wussed out and used a monitor to connect to your Pi.
sudo apt-get update && sudo apt-get upgrade sudo apt-get clean sudo reboot
to get Rasbian bang up to date.
At this stage it’s worth assigning your Pi a permanent IP, as this will be essential to reliably translate internet HTTP/HTTPS traffic from your home router to your Pi. You have two options; configure the Pi with a static IP, or assign a reserved IP on your router.
I’ve opted for a reserved IP on my home router, as I like having central control of the non-dynamic IPs on my network. As there are so many home router models, I won’t be able to guide you on how to set a reserved IP on your specific router model, but it’s generally quick a simple task. You’ll be looking for the DHCP page, and will have to supply the MAC address of the Pi (you can get this from our previous network scan, or by viewing current DHCP leases on the router).
If you want to set a static address on the Pi itself, below is a link detailing the process. You might find the DHCP reservation a more attractive option after-all…
With SSH connectivity to our networked Pi on a reserved/static IP address, we’re now ready to install WordPress itself, along with the web server stack it requires, which I’ll cover in the next part.