How to install and configure PyroCMS on Ubuntu server

PyroCMS is a Laravel PHP Framework based web application. It is available to use free as well as paid. You can subscribe to its Pro package. PyroCMS is built using Laravel, so it supports MySQL, Redis, MS SQL, SQLite, PostgreSQL and every other database option supported by Laravel.

PyroCMS comes under MIT license and provide its core product and features 100% free to its users. It is very simple, clean and easy to use. It has a versatile admin panel. Its admin control panel is faster, easier and understandable. PyroCMS supports mobile and tablets as well as desktop and laptop. It is responsive and compatible with all sizes of screen.

PyroCMS supports a multilingual system. It allows you to override core translations without hacking. It provides CLI to build addons and data structures. PyroCMS has many addons that can be used to enhance or extend its features at any time.

In this tutorial, I will be using Virtual Private Server (VPS) with Ubuntu 16.04 installed on it. I will install and setup PyroCMS.


  • You must have a virtual private server (VPS). You can buy VPS here at the cheapest price at a supermicro store.
  • ECS must have at least 1GB RAM and 1 Core processor.
  • Register your domain name. If you have already registered a domain, you can update its nameserver records.
  • Domain name must be pointed to your Alibaba Cloud ECS’s IP address.
  • You should setup your server’s hostname.
  • Access to your server via SSH client.
  • Login as root user and create user with sudo privileges.

Update your Ubuntu System:

Before proceeding with installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with sudo privileges. After execution of this command, you will be prompted to Is this ok? Type ‘y’ and hit Enter key.

Step 1:

# sudo apt update && sudo apt upgrade

Install PHP:

PyroCMS requires installation of PHP 7.0 or newer version of PHP. In this tutorial, you will install PHP 7.2. To install PHP 7.2, execute the following steps.

Step 1:

In the first step, you will need to install python software properties and software properties common. To do so, execute the command below.

# sudo apt-get install software-properties-common python-software-properties 

You will need to add repository for newer versions of PHP. To do so, execute the commands below.

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

Step 2:

Update the system to refresh the available repositories. To do so, execute the command for updating Ubuntu system.

# sudo apt update

Step 3:

Now let’s install PHP 7.2. To install PHP 7.2, execute the following command.

# sudo apt install -y php7.2

Install required PHP extensions:

PyroCMS requires the following PHP extensions:

  1. php7.2-cli
  2. php7.2-fpm
  3. php7.2-mysql
  4. php7.2-curl
  5. php7.2-sqlite3
  6. php7.2-gd
  7. php7.2-mbstring
  8. php7.2-dom

To install the above extensions of PHP, execute the following command.

# sudo apt-get -y install php7.2-cli php7.2-fpm php7.2-dom php7.2-mbstring php7.2-mysql php7.2-curl php7.2-sqlite3 php7.2-gd 

When you have done installation of the above extensions, apache2 will be installed automatically. Hence, you don’t need to install apache explicitly.

How to check confirm installation?

To check PHP installation, you can execute the following command to check installed PHP version.

# php --version

Install MariaDB

PyroCMS supports MySQL, PostgreSQL, MSSQL, Redis and SQLite. In this tutorial, you will use MariaDB server for MySQL. By default, Ubuntu repository has older version of MariaDB server. To use new version of MariaDB, you will need to add MariaDB repository to your Ubuntu system. To do so, follow the steps below.

Step 1:

Verify the keys by executing command.

# sudo apt-key adv --recv-keys --keyserver hkp:// 0xF1656F24C74CD1D8

Step 2:

Add the repository using the command.

# sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] xenial main' 

Step 3:

Now update the system by using command.

# sudo apt update

Step 4:

Now install MariaDB using the following command.

# sudo apt install -y mariadb-server

Step 5:

Now start and enable the MariaDB server so that after reboot, the server can start automatically.

# sudo systemctl start mariadb
# sudo systemctl enable mariadb

Step 6:

Now run the following command to enhance security of MariaDB server and set password for the root user.

# sudo mysql_secure_installation

Now connect to the MySQL shell as root user using the command below and enter your password.

# sudo mysql -u root -p

Execute the following MySQL queries in your MariaDB server.

CREATE USER 'aareez'@'localhost' IDENTIFIED BY '654321Ab';
GRANT ALL PRIVILEGES ON pyro.* TO 'aareez'@'localhost';

Install Unzip:

You will need to install unzip which will be used to unzip the compressed zip folder. To install unzip, execute the command.

# sudo apt-get install unzip -y

Install curl:

To install curl, execute the command.

# sudo apt-get install curl -y

Install git:

To install git, execute the command.

# sudo apt-get install git -y

Install Composer:

To install and setup composer, execute the following demands.

# php -r "copy('', 'composer-setup.php');"
# php -r "if
(hash_file('SHA384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
# php composer-setup.php
# php -r "unlink('composer-setup.php');" 
# sudo mv composer.phar /usr/local/bin/composer 

Now you can check if composer installed successfully by executing the command to check the version of composer.

# composer -v

Install PyroCMS:

To install PyroCMS, you will need to follow the steps.

Step 1:

Navigate to /var/www/html using the command.

# cd /var/www/html

Now change ownership of /var/www/html directory to aareez.

# sudo chown -R aareez:aareez /var/www/html

Step 2:

Remove index.html file using the command below.

# sudo rm index.html

Now download the latest stable release of PyroCMS using the command below.

# composer create-project pyrocms/pyrocms

Step 3:

Now provide ownership of /var/www/html to www-data so that apache server can access the required files.

# sudo chown -R www-data:www-data /var/www/html 

Configure Apache server:

Let’s create virtual host configuration file for PyroCMS. Execute the following command, a file will be opened in nano text editor.

# sudo nano /etc/apache2/sites-available/pyro.conf

Copy and PyroCMS the following code and save the file.

<VirtualHost *:80> 
    DocumentRoot /var/www/html/pyrocms/public
    DirectoryIndex index.php index.htm index.html
   <Directory /var/www/html>
        Options +FollowSymLinks
        AllowOverride All
        Require all granted
 ErrorLog ${APACHE_LOG_DIR}/PyroCMS_error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/PyroCMS_access.log combined

Execute the command below to disable default site.

# sudo a2dissite 000-default.conf

Now you will need to enable the newly created virtual host. To do so, execute the command below.

# sudo a2ensite pyro

Now you will need to enable rewrite mod. You can do so by editing configuration file in apache2 directory or you can simply execute the command below.

# sudo a2enmod rewrite

Now you will need to enable SSL engine. You can do so by editing configuration file in apache2 directory or you can simply execute the command below.

# sudo a2enmod ssl

Now you will have to restart apache server to apply the changes and load the settings by executing command below.

# sudo service apache2 restart

Now you can access PyroCMS via your domain name or ECS IP address. In my case, I have accessed via .

Tick the checkbox shown below to agree with these terms.

pyrocms vps tutorial

Configure database:

Now fill in the following form for configuring database.

pyrocms vps tutorial

Configure admin account:

To access admin panel of PyroCMS, you will need administrator’s account. To create admin account, fill in the following form.

pyrocms vps tutorial

Now make basic settings:

You will need to set name, primary domain name, language and timezone for PyroCMS. To do this, fill in the form given below and hit install button to continue.

pyrocms vps tutorial

You will see the following screen during installation. Wait until it finishes.

pyrocms vps tutorial

After completion of successful installation, you may click login to access admin panel and view site to navigate to your website.

pyrocms vps tutorial

On clicking login, you will see the following screen.

pyrocms vps tutorial

After successful login to your admin panel, you will see the following dashboard.

pyrocms vps tutorial

Install SSL certificate:

To install SSL certificate using let’s encrypt, you will use Certbot. To do so, execute the following steps.

Step 1:

Update the package using command.

# sudo apt-get update

Step 2:

To install software-properties-common, execute the command below.

# sudo apt-get install software-properties-common

Step 3:

Add the certbot repository by using command below.

# sudo add-apt-repository ppa:certbot/certbot

Step 4:

Update the package to load the added certbot repository using command.

# sudo apt-get update

Stop apache before issuance of SSL certificate.

# sudo systemctl stop apache2

Step 5:

Now install python-certbot-apache using the command below.

# sudo apt-get install python-certbot-apache

Step 6:

Execute the following command to get let’s encrypt SSL issued.

# sudo certbot --apache -d

Select the option 2 to redirect the link to https and update virtual host settings for SSL.

pyrocms vps tutorial

Now SSL certificate has been installed successfully, you will have to restart apache server.

# sudo systemctl start apache2

Now you can access your website using https protocol. https://www.your_domain_name.tld

pyrocms vps tutorial

Setup firewalls for http, https and other required port:

You will need to open port 80 and 443. To do this, you may read the article on firewalls.

Congratulations….!! here you go, you have successfully installed and configured PyroCMS on your server.

Leave a Reply

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