Install Subrion CMS with LAMP Stack On Ubuntu 20.04

Updated on October 5, 2021
Install Subrion CMS with LAMP Stack On Ubuntu 20.04 header image

Introduction

Subrion is an open-source Content Management System (CMS) with a powerful modern administrator interface, suitable for building personal websites, blogs, and corporate web portals. Subrion ships with a modern API, professional-looking templates, and plug-ins that allow you to extend its functionalities and change the look of your website depending on your needs. This guide explains how to install Subrion CMS with a LAMP stack on your Ubuntu 20.04 server.

Prerequisites

To complete this tutorial, you require the following:

1. Install Subrion Dependencies and Helper Packages

Connect to your server via SSH and follow the steps below.

  1. Update the package information index.

     $ sudo apt update
  2. Install libapache2-mod-php to allow Apache to communicate with PHP.

     $ sudo apt install -y libapache2-mod-php
  3. Enable Apache's mod_rewrite module to allow Subrion CMS to craft user-friendly URLs.

     $ sudo a2enmod rewrite
  4. Restart your web server to load the new modules.

     $ sudo systemctl restart apache2
  5. Download and install the unzip package, which you need to unzip Subrion CMS installation files.

     $ sudo apt -y install unzip

2. Set Up a Database and a User Account

Subrion works with either the MySQL or MariaDB server. Follow the steps below to set up a backend for the CMS.

  1. Log in to the MySQL/MariaDB server as root.

     $ sudo mysql -u root -p
  2. Enter the root password for your MySQL/MariaDB server and press Enter to proceed. Then, run the appropriate SQL statements depending on the database engine you use. Replace EXAMPLE_PASSWORD with a strong value.

    MySQL server:

     mysql> CREATE DATABASE subrion;
            CREATE USER 'subrion_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'EXAMPLE_PASSWORD';
            GRANT ALL PRIVILEGES ON subrion.* TO 'subrion_user'@'localhost';           
            FLUSH PRIVILEGES;

    MariaDB server:

     MariaDB> CREATE DATABASE subrion;
              GRANT ALL PRIVILEGES on subrion.* TO 'subrion_user'@'localhost' identified by 'EXAMPLE_PASSWORD';
              FLUSH PRIVILEGES;
  3. Log out from your database server.

     mysql> EXIT;

3. Download Subrion CMS

You should install Subrion CMS in a separate directory to make maintenance and troubleshooting easier in the future.

  1. Create a new subrion directory under the root of your web server.

     $ sudo mkdir -p /var/www/subrion
  2. Take ownership of the new /var/www/subrion directory.

     $ sudo chown -R $USER:$USER /var/www/subrion
  3. Navigate to the new directory.

     $ cd /var/www/subrion
  4. Download the latest stable version of the Subrion CMS from the official subrion.org repository.

     $ sudo wget https://tools.subrion.org/get/4.1.5.zip
  5. Unzip the 4.1.5.zip file to your current directory.

     $ sudo unzip 4.1.5.zip
  6. Change ownership of the /var/www/subrion directory to the www-data user to allow Apache to read/write to the directory.

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

4. Create Virtual Host

The Apache web server reads virtual hosts configurations from the /etc/apache2/sites-available directory. Therefore, you need to set up a separate file for the Subrion CMS.

  1. Disable the default 000-default.conf configuration file.

     $ sudo a2dissite 000-default.conf
  2. Create a new subrion.conf configuration file.

     $ sudo nano /etc/apache2/sites-available/subrion.conf
  3. Paste the information below into the new file. Replace example.com with your server's public IP address or domain name.

     <VirtualHost *:80>
    
         ServerName example.com
    
         DocumentRoot "/var/www/subrion"
    
         <Directory "/var/www/subrion">
             Require all granted
             Options -Indexes +FollowSymLinks
             AllowOverride All
             Order allow,deny
             Allow from all
         </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
     </VirtualHost>
  4. Save and close the file.

  5. Add the new subrion.conf to the list of enabled sites.

     $ sudo a2ensite subrion.conf
  6. Restart the web server to load the new configurations.

     $ sudo systemctl restart apache2

5. Test Subrion Installation

  1. Visit the address http://example.com in a web browser. Replace example.com with your domain name or public IP address of your server.

  2. Follow the web-based wizard to complete installing Subrion CMS.

  3. Delete the installation script and secure the config.inc.php file for security purposes.

     $ sudo rm /var/www/subrion/install/modules/module.install.php
     $ sudo chmod 400 /var/www/subrion/includes/config.inc.php 
  4. Append /panel to your server's public IP address or domain name to access the administration panel. For instance, http://example.com/panel.

Conclusion

In this guide, you've installed the Subrion CMS with LAMP stack on your Ubuntu 20.04 server. For more information on configuring your Subrion CMS, follow the link below.