Up and Running

Fri 17 April 2015 by Matt Fettke

These are the steps I went through to get this site up and running. I'm using Pelican to generate the content, published on a droplet from DigitalOcean. I also set up a Piwik server to gather some statistics.

Step 1 - LAMP server

I'm using the smallest Droplet from Digital Ocean because it's cheap ($5/month) and I don't expect this site to get smashed by visitors. Any VPS vendor would be fine, and these days there are plenty of options. My droplet is running Debian - it's been my go-to server distribution for many years.

Once you have a server, you need to install the software stack. First, install apache:

sudo apt-get install apache2

We'll configure some virtual hosts soon, but before that install MySQL:

sudo apt-get install mysql-server

Make sure you set the root password when prompted. Next, run

mysql_secure_installation

and answer "yes" to every question. Finally, create a database and user for Piwik:

$ mysql -u root -p
mysql> CREATE DATABASE piwik_db;
mysql> CREATE USER 'piwik'@'localhost' IDENTIFIED BY 'tricky_password';
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, CREATE TEMPORARY TABLES,
       LOCK TABLES ON piwik_db.* TO 'piwik'@'localhost';
mysql> quit

Now that Apache and MySQL have been installed we are ready to install PHP:

sudo apt-get install php5 php-pear php5-gd php5-mysql

Tune the configuration file in /etc/php5/apache2/php.ini:

max_execution_time = 30
memory_limit = 64M
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
log_errors = On
error_log = /var/log/php.log

To finalise the LAMP stack, restart Apache:

sudo service apache2 restart

Piwik

Now to configure Piwik.