29th May, 2017 | Tutorials |

How to Install FlatPress on Ubuntu 14.04

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.

Get a Cloud Server

FlatPress is a blogging engine that save posts as simple text files so we don't need a database.

Several features of FlatPress:

You can learn more about FlatPress from the FlatPress website.


In this tutorial we'll learn how to install FlatPress on Ubuntu 14.04. We will also install and configure its prerequisites.


We will install FlatPress on a fresh installation of Ubuntu Server 14.04. We also need these application to be able to run FlatPress:

Update Base System

Before we install FlatPress, let's update the system to the latest update.

$ sudo apt-get update
$ sudo apt-get -y upgrade

Install Apache 2

After applying latest update to our base system, Lets's start installing Apache 2 and required libraries.

$ sudo apt-get -y install apache2 apache2-bin apache2-data apache2-mpm-prefork libaio1 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libterm-readkey-perl libwrap0 ssl-cert tcpd

We can check Apache 2 service status using command below:

sudo service apache2 status
 * apache2 is running

We can also check whether Apache 2 is listening on which port using command below.

 sudo netstat -naptu | grep apache
tcp6       0      0 :::80                   :::*                    LISTEN      14873/apache2

Install PHP 5

The last component that we have to install before we can install flatpress is PHP 5. We will install PHP 5 and several common PHP libraries.

$ sudo apt-get -y install php5-cli php5-common php5-json php5-readline

Restart Apache 2 process so the changes will be applied:

$ sudo service apache2 restart

Install Flatpress

All prerequisites are already installed. So we're ready to install flatpress. The latest stable version of flatpress is available FlatPress download page.

At the time of this writing, the latest stable version is version 1.0.3, let's download flatpress compressed file using wget.

$ wget -c

Extract FlatPress archive:

$ tar xzf v1.0.3.tar.gz

Move flatpress-1.0.3 folder to Apache directory as flatpress.

$ sudo mv flatpress-1.0.3 /var/www/flatpress

Change ownership of flatpress directory to www-data user and group.

$ sudo chown -R www-data:www-data /var/www/flatpress

Flatpress files is ready, now let's create Apache Virtual Host configuration to serve flatpress.

Configure Apache Virtual Host for http Only

Create new apache configuration file on /etc/apache2/sites-available/flatpress.conf with contents below.

<VirtualHost *:80>

DocumentRoot /var/www/flatpress

<Directory /var/www/flatpress> Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory>

ErrorLog ${APACHE_LOG_DIR}/ CustomLog ${APACHE_LOG_DIR}/ combined


Don't forget to change above with the domain name that you use for your flatpress installation.

Enable the site using a2ensite command.

$ sudo a2ensite flatpress

Reload the apache2 process so it read the new virtualhost configuration:

$ sudo service apache2 reload

FlatPress Installer

Open the FlatPress URL, we will be redirected to FlatPress installer.

First step, click Next

HP_NO_IMG/data/uploads/users/f94d86e4-8771-4484-b2df-35ce7fb402d0/1833882765.png" alt="" />

Create admin user. input username, password email and FlatPress URL. Click Next

HP_NO_IMG/data/uploads/users/f94d86e4-8771-4484-b2df-35ce7fb402d0/1447541034.png" alt="" />

Done. FlatPress installation finished.

HP_NO_IMG/data/uploads/users/f94d86e4-8771-4484-b2df-35ce7fb402d0/1617502886.png" alt="" />

Our FlatPress site is ready.

HP_NO_IMG/data/uploads/users/f94d86e4-8771-4484-b2df-35ce7fb402d0/1756608998.png" alt="" />

When we click login from the sidebar of the homepage we will get FlatPress login prompt.

HP_NO_IMG/data/uploads/users/f94d86e4-8771-4484-b2df-35ce7fb402d0/155997909.png" alt="" />

After successfully login we will go to FlatPress administration are where we can manage our FlatPress site.

HP_NO_IMG/data/uploads/users/f94d86e4-8771-4484-b2df-35ce7fb402d0/1339753175.png" alt="" />

Configure https only site for flatpress

Secure connection is now a requirement for web application.

Last step that we will do in this tutorial is changing the connection to only use https.

We assume that you already have SSL certificate and private key.

Let's create new apache virtual host configuration on /etc/apache2/sites-available/flatpress-ssl.conf with contents below. Don't forget to change:

<VirtualHost *:80>
   Redirect permanent /

<VirtualHost *:443>


DocumentRoot /var/www/flatpress

<Directory /var/www/flatpress> Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory>

ErrorLog ${APACHE_LOG_DIR}/ CustomLog ${APACHE_LOG_DIR}/ combined

SSLEngine on SSLCertificateFile /etc/apache2/ssl/ SSLCertificateChainFile /etc/apache2/ssl/ SSLCertificateKeyFile /etc/apache2/ssl/

# Uncomment the following directive when using client certificate authentication #SSLCACertificateFile /path/to/ca_certs_for_client_authentication

# HSTS (mod_headers is required) (15768000 seconds = 6 months) Header always set Strict-Transport-Security "max-age=15768000"



We will also disable flatpress http only virtual host and enable the new virtual host config.

$ sudo a2dissite flatpress
$ sudo a2ensite flatpress-ssl

The new virtual host configuration need Apache mod_ssl and mod_headers modules. We need to enable those modules.

$ sudo a2enmod ssl
$ sudo a2enmod headers

Now, restart Apache 2 service so it will reload its configuration. We need to restart instead of reload since we enable new module.

$ sudo service apache2 restart

We need to change flatpress configuration to works with https.

Open /var/www/flatpress/defaults.php. Find this line

define('BLOG_BASEURL', 'http://'.$_SERVER['HTTP_HOST']. BLOG_ROOT);

Replace the http:// above with https://


In this tutorial we learned how to install flatpress on Ubuntu 14.04.

We installed all the prerequisites and also configure Apache 2 virtual hosts to be able to serve flatpress.

We also configure https settings for flatpress so we run FlatPress securely.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.

Get a Cloud Server