Install FlatPress CMS on Ubuntu 20.04 LTS

Updated on November 2, 2021
Install FlatPress CMS on Ubuntu 20.04 LTS header image

Introduction

FlatPress is an open-source Content Management System (CMS) blogging engine that does not require a database. It is based on PHP, is multi-lingual, and stores all its content on text files. It also supports various plugins, widgets, and customizable themes. It enables editing your website live and with ease. In this article, you will learn how to install FlatPress CMS on Ubuntu 18.04 and 20.04 server.

Prerequisites

1. Install LAMP Server

Update system package manager.

$ sudo apt update

Add the ppa:ondrej/php PPA repository.

$ sudo apt -y install software-properties-common

$ sudo add-apt-repository ppa:ondrej/php

Update system package manager.

$ sudo apt update

Install PHP 7.4 and extra packages.

$ sudo apt install apache2 php7.4 libapache2-mod-php7.4 php7.4-common php7.4-sqlite3 php7.4-json php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-mysql php7.4-gd php7.4-xml php7.4-cli php7.4-zip php7.4-soap php7.4-imap php7.4-bcmath php7.4-gmp wget unzip -y

List available time zones and choose your preference.

$ sudo timedatectl list-timezones

Edit the PHP configuration file.

$ sudo nano /etc/php/7.4/apache2/php.ini

Change the following values, and replace Africa/Nairobi with your timezone save and close the file:

To search for a specific line, use Control + W, enter search phrase then press Enter.

max_execution_time = 600    
memory_limit = 256M
upload_max_filesize = 100M
post_max_size = 100M
max_input_time = 600
date.timezone = Africa/Nairobi

2. Install FlatPress

Download the latest FlatPress installation files. To find the latest version, visit release page.

$ wget https://github.com/flatpressblog/flatpress/archive/1.2.1.zip

Create the installation directory /var/www/html/flatpress.

$ sudo mkdir /var/www/html/flatpress

Extract the downloaded files.

$ sudo unzip 1.2.1.zip

Move the files to the installation directory.

$ sudo mv flatpress-1.2.1/* /var/www/html/flatpress

Change ownership of the installation directory.

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

Change access permissions for the directory.

$ sudo chmod -R 755 /var/www/html/flatpress/

3. Configure Apache2

Create a new configuration file named flatpress.conf.

$ sudo nano /etc/apache2/sites-available/flatpress.conf

Add the content below into the file and save it:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html/flatpress
    ServerName example.com
    ServerAlias www.example.com

     <Directory /var/www/html/flatpress/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
    
     <Directory /var/www/html/flatpress/>
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*) index.php [PT,L]
    </Directory>
</VirtualHost>

Change to Apache configuration files directory.

$ cd /etc/apache2/sites-available/

Enable the created virtual host configuration.

$ sudo a2ensite flatpress.conf

Disable the default Apache configuration.

$ sudo a2dissite 000-default.conf

Enable the Apache rewrite module.

$ sudo a2enmod rewrite

Restart Apache service for the changes to take effect.

$ sudo systemctl restart apache2

4. Access FlatPress Web Interface

Open your web browser and browse to http://Server_IP. For example:

http://192.0.2.10/

Conclusion

You have installed FlatPress on your server. Use the FlatPress setup wizard to complete the installation. Create an administrator account and continue to the dashboard.

More Information

To learn more about FlatPress, go to the official documentation page.