After doing my posts on how to install lighttpd web server and php/mysql on a raspberry pi a few people asked if I could do one on how to install wordpress as well.

As this is something i’ve thought about doing before due to setting up a few pi webservers I started working on an image based on raspian that people would be able to download and install on an sd card however I hit a bump when it came to cutting down the installed packages as different people have different requirements and if I just added to an existing one it would still be a couple of gigabytes.

Undeterred I thought i’d write a bash script that would install the required packages and made it as simple as possible for users to get going.

So I present to you PiPress

**** This software is provided as is and comes with no warranty if it breaks you installation/bricks your pi don’t come moaning to me****

Note the source code of the script is encrypted, the reason is it tooks me a few hours to do and I wasn’t originally intending to release it in the public domain. If this concerns or worries you please don’t install it. If you do you are welcome to do any security checksĀ  you want.

The script was tested on a FRESH install of 2014-09-09-wheezy-raspbian.img if you are installing it on a system other than this or one that contains other packages/web servers etc it may well break something.

What it does

Updates packages via apt
Downloads and installs lighttpd php5-cgi phpmyadmin mysql-server mysql-client php5-mysql via apt
Sets mysql root password
Sets up wordpress database and user
Downloads and extracts latest version of wordpress from https://wordpress.org/latest.zip
Passes database data to wp-config.php
Sets permissions on /var/www
Creates a phpinfo page (this is a potential security risk and you should delete it after viewing, it’s there so you are able to view installed modules for trouble shooting etc).
Users the IP address from eth0 to provide urls, if your using wireless ie wlan0 this feature won’t work.

HowTo

cd to a directory ie tmp (doesn’t really matter which as the install file gets deleted on completion)

cd /tmp

Download the script

wget http://www.theoutpost.org/downloads/scripts/PiPress -v -O PiPress && chmod u+x PiPress && sudo ./PiPress && sudo rm PiPress

The script will download and start automatically. From here on most of it should be self explanatory, here is the output from a complete install.

Choose a MSQL root user password

Password: raspberry

Define wordpress database settings, database will be be created autmatically with the credentials provided.

Database name: wordpress
Hostname: localhost
Database user: pi
Database password: raspberry

Updating apt
done

Install lighttpd and set permissions
Open browser to http://192.168.1.113 lighttpd holding page should be shown
done

Install php
Open browser to http://192.168.1.113/phpinfo.php to view php parameters
done

Install phpmyadmin
done

Install MYSQL server and client
done

Setup wordpress mysql database and user
done

Installing wordpress
done

Install phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)
done

Restarting services
[ ok ] Stopping MySQL database server: mysqld.
[ ok ] Starting MySQL database server: mysqld . . ..
[info] Checking for tables which need an upgrade, are corrupt or were not closed cleanly.. [ ok ] Stopping web server: lighttpd.
[ ok ] Starting web server: lighttpd.
done

**** PiPress Settings ****

MYSQL root password: raspberry

WordPress MYSQL Database settings
Databse name: wordpress
Hostname: localhost
Database user: pi
Database password: raspberry

A copy of settings has been saved in /home/pi/PiPress.conf

Open browser to http://192.168.1.113 to complete wordpress installation

FINISHED!

cat /home/pi/PiPress.conf

**** PiPress Settings ****

MYSQL root password: raspberry

WordPress MYSQL Database settings
Databse name: wordpress
Hostname: localhost
Database user: pi
Database password: raspbery

It is a potential security risk having a phpinfo page on your server, you should delete it from /var/www/phpinfo.php

I hope someone finds this useful and welcome and constructive feedback or any tweaks you’d like to see.

Leave a Reply

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