Installing WordPress on Raspberry Pi

Just a novice guide for running WordPress with nginx on Raspberry Pi.

Download the Raspbian Lite image from


At the time of writing this, we’re having Raspbian Jessie Lite released on 2016-09-23.

Unzip Raspbian Lite image that we’ve downloaded

Write it to your sdcard using the following commands(these commands are for MacOS)

Change directory (cd)  to the folder where that unzipped image file is.

  1.  sudo diskutil list 
  2. sudo diskutil unmountDisk disk2
  3. sudo dd bs=5m if=2016-09-23-raspbian-jessie-lite.img of=/dev/rdisk2

After the image is written to the sdcard, eject it from the system, then place it in Raspberry Pi

Connect ethernet cable to the Raspberry Pi, and power it on by connecting the MicroUSB power cable (you don’t need to connect any keyboard or display to this device yet).

You’ll get the IP address of the Pi from your router, just SSH to it using :

ssh [email protected]

The default password will be “raspberry”

First things we want to do on that new installation is, expand the filesystem(in case not expanded by default)

sudo raspi-config


Select the first option

1 Expand Filesystem


Then goto Advanced Options and select “Memory Split”



Change the value to 16(we’re not running any graphical interface on the device, so we’re changing this value to ensure most of the RAM is available for our web server.


Now go to “Internationalisation Options” and select “Change Locale”

Select “en_US.UTF-8 UTF-8”

Unselect any other locales there are selected.





After this is done, press “Finish” (right arrow key twice) from the menu, and it will ask for a restart,



Now to avoid perl giving error messages about the LANGUAGE not set, we’ll need to modify one file, you can use nano editor but I like using vim only, so thats the first thing I install on a server.

sudo apt-get install vim

Now edit the file /etc/environment using vim

sudo vim /etc/environment

and add the following lines:


Now exit the shell using


and SSH again to RPi

Make sure there are no errors listed when you type


command(press ctrl+c to exit)

Now we’ll need to deb package to install latest PHP and NGINX on the server

Adding stretch release for latest PHP and NGINX(as read on

sudo vi /etc/apt/sources.list

Add this line under the first jessie line:

deb stretch main contrib non-free rpi

If you don’t want all packages to be downloaded from stretch release you can add following code in apt preferences

vim /etc/apt/preferences.d/stretch

and paste the following:

Package: *
Pin: release n=jessie
Pin-Priority: 600

Now we’ll upgrade all packages on the system

sudo apt-get update
sudo apt-get upgrade

When the upgrade is complete lets install NGINX, PHP5-FPM server and MySQL server on RPi

sudo apt-get install -t stretch php7.0 php7.0-curl php7.0-gd php7.0-fpm php7.0-cli php7.0-opcache php7.0-mbstring php7.0-xml php7.0-zip php7.0-mysql nginx-extras mysql-server-5.6 

and for some other needed tools(we’re not using -t stretch as we want other apps to be fetched from stable repo):

sudo apt-get install htop git

The installation will ask you to add root password for MySQL server, so wait for it before going anywhere, once you enter the password, check the status of installation after 10-15 minutes(this can take some time depending upon your internet speed and the speed of memory card you’ve used, I had issues with SanDisk’s memory cards, though they work fine on phones and laptop, the speed was way too low on Raspberry Pi somehow, currently using Strontium Nitro UHS-1 card, which is performing well with RPi)

Now that we have PHP, Nginx and MySQL running on Raspberry Pi, lets get started with WordPress

First step would be to install wp-cli, which is quite the easy thing

curl -O
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

Now enter this command to see if its working

wp --info


Leave a Reply

Your email address will not be published. Required fields are marked *