Learn How To Installing Pagekit CMS on Ubuntu 16.04 LTS

July 6, 2019

Table of Contents

If you are using a different system, please check our other tutorials.

Pagekit is an open source CMS written in PHP. Pagekit source code is hosted on GitHub. This guide will show you how to install Pagekit CMS on a fresh Ubuntu 16.04 LTS IT Web Services instance.

Requirements

Make sure your server meets the following requirements.

  • Apache 2.2+ or NGINX.
  • MySQL Server 5.1+ or SQLite 3.
  • PHP Version 5.5.9+.
  • Required PHP extensions: JSON, Session, ctype, Tokenizer, SimpleXML, DOM, mbstring, PCRE 8.0+, ZIP and PDO with MySQL or SQLite drivers.
  • Optional PHP extensions: cURL, iconv and XML Parser, as well as APC or XCache for caching.

Before you begin

Check the Ubuntu version.

lsb_release -ds
# Ubuntu 16.04.3 LTS

Create a new non-root user account with sudo access and switch to it.

adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

sudo dpkg-reconfigure tzdata

Ensure that your system is up to date.

sudo apt update && sudo apt upgrade -y

Step 1 – Install PHP and required PHP extensions, MySQL and NGINX

Download and install PHP 7.0 and required PHP extensions. We will also install optional PHP extensions.

sudo apt install -y php7.0 php7.0-cli php7.0-fpm php7.0-mbstring php7.0-zip php7.0-mysql php7.0-sqlite3 php7.0-curl php7.0-simplexml php7.0-common

Check PHP version.

php --version
# PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
# Copyright (c) 1997-2017 The PHP Group
# Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
#     with Zend OPcache v7.0.22-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

Because there are many existing IT Web Services Docs detailing the installation of MySQL and NGINX, this article will only cover the configuration of NGINX.

Step 2 – Configure NGINX

Run sudo vim /etc/nginx/sites-available/pagekit.conf and copy/paste the following.

server {
    listen [::]:80;
    listen 80;
    server_name example.com;
    index index.php index.html;
    root /var/www/pagekit;
    # PHP setup with query string support
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    location ~ .php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_param  HTTP_MOD_REWRITE  On;
    }
}

Activate the new pagekit.conf configuration by linking the file to the sites-enabled directory.

sudo ln -s /etc/nginx/sites-available/pagekit.conf /etc/nginx/sites-enabled/

Test the NGINX configuration.

sudo nginx -t

Reload NGINX and restart PHP7.0-FPM.

sudo systemctl reload nginx.service
sudo systemctl restart php7.0-fpm.service

Step 3 – Download and install Pagekit CMS

Create a document root directory.

sudo mkdir -p /var/www/pagekit

Change ownership of the /var/www/pagekit directory to johndoe.

sudo chown -R johndoe:johndoe /var/www/pagekit

Navigate to document root.

cd /var/www/pagekit

Download the latest stable release of Pagekit CMS from the command line.

wget https://github.com/pagekit/pagekit/releases/download/1.0.13/pagekit-1.0.13.zip

Install unzip package.

sudo apt install unzip

Unzip Pagekit CMS and remove downloaded zip file.

unzip pagekit-1.0.13.zip
rm pagekit-1.0.13.zip

Change ownership of the /var/www/pagekit directory to www-data.

sudo chown -R www-data:www-data /var/www/pagekit

Open your domain/IP in the web browser and follow the Pagekit CMS installation wizard. After that you will have Pagekit installed on your Ubuntu 16.04 LTS server.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!