How to Install and Configure October CMS 2 on a Ubuntu 20.04 Server

Updated on November 21, 2023
How to Install and Configure October CMS 2 on a Ubuntu 20.04 Server header image

October CMS 2 is a simple and reliable content management system with features like Twig templating, extendable functionality via Plugins, built-in image cropping and advanced file management. This guide explains how to install October CMS on a Ubuntu 20.04 LAMP server.

Prerequisites

Before starting this guide:

1. Edit Apache Configuration

Edit the Apache default site configuration file to make changes that will allow October CMS to run smoothly on your server.

  1. Edit the file.

     $ sudo nano /etc/apache2/sites-enabled/000-default.conf 

    Find the line:

     DocumentRoot "/var/www/html"

    Edit the document root entry to include the rules below.

     <Directory /var/www/html/>
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Order allow,deny
         allow from all
     </Directory>
  2. Save and close the file

  3. Enable the mod_rewrite Apache module.

     $ sudo a2enmod rewrite
  4. Enable and start Apache at boot time.

     $ sudo systemctl enable apache2
     $ sudo systemctl start apache2
  5. Restart the service to reload the new changes.

     $ sudo systemctl restart apache2
  6. Verify Apache is running.

     $ sudo systemctl status apache2
  7. October CMS 2 requires PHP 7.2.9 or higher and several PHP extensions. To install PHP and all required extensions:

     $ sudo apt -y install php php-ctype php-curl php-xml php-fileinfo php-gd php-json php-mbstring php-mysql php-sqlite3 php-zip libapache2-mod-php

2. Create an October CMS Database

  1. Log in to MySQL as root and enter your password.

     $ sudo mysql -u root -p
  2. Create the October CMS database.

     > CREATE DATABASE october_db CHARACTER SET utf8 COLLATE utf8_general_ci;
  3. Create a new database user and assign it a strong password.

     > CREATE USER 'october_user'@'localhost' IDENTIFIED BY 'YOUR_STRONG_PASSSWORD';
  4. Grant the new user full rights to the October CMS database.

     > GRANT ALL PRIVILEGES ON october_db.* TO 'october_user'@'localhost';
  5. Refresh MySQL user privileges and exit.

     > FLUSH PRIVILEGES;
     > EXIT;
  6. Test that your newly created user has rights to the database.

     $ mysql -u october_user - p
  7. Enter the user password and display databases assigned to the user.

     > SHOW DATABASES;
  8. Enable MySQL server to start at boot time, and restart the service to apply changes.

     $ sudo systemctl enable mysql
     $ sudo systemctl restart mysql   

3. Install Composer

October CMS 2 uses Composer to manage its dependencies, the CMS does not have a direct installation candidate, and composer is used to download all necessary CMS files required to create projects.

  1. To install Composer, re-update your system and install the Composer PHP extensions.

     $ sudo apt update
     $ sudo apt install wget php-cli php-zip unzip curl
  2. Download Composer

     $ curl -sS https://getcomposer.org/installer | php
  3. Move the downloaded file to /usr/local/bin to make it a system wide application on your server.

     $ sudo mv composer.phar /usr/local/bin/composer
  4. Verify your installation and see the version.

     $ composer

4. Install October CMS 2

  1. Create a new October CMS project directory named myexample.

     $ composer create-project october/october myexample
  2. Move the new project to Apache's web root.

     $ sudo mv -R myexample/ /var/www/html/
  3. Grant Apache permissions to October CMS.

     $ sudo chown -R www-data:www-data  /var/www/html/myexample/
  4. Change the Apache 2 configuration to point to your October CMS Installation directory.

     $ sudo nano /etc/apache2/sites-enabled/000-default.conf 

    Find this line:

     DocumentRoot "/var/www/html/”

    Change it to:

     DocumentRoot "/var/www/html/myexample"
  5. Save and exit the file.

  6. Restart Apache.

     $ sudo systemctl restart apache2
  7. Change to the October CMS working directory.

     $ cd /var/www/html/myexample
  8. Run PHP Artisan.

     $ sudo php artisan october:install
  9. Choose your preferred October CMS language, English is the default.

  10. Enter your domain name, then choose a custom access URL.

     Application URL [http://localhost]:
         > 
  11. Select a custom backend URI for administration.

     Backend URI [/backend]:
         > 
  12. Select MySQL database server.

     Database Engine [SQLite]:
         [0] SQLite
         [1] MySQL
         [2] Postgres
         [3] SQL Server
         > 
  13. Use the default value of 127.0.0.1 for Database Host.

     Database Host [127.0.0.1]:
     > 
  14. Enter 3306 for database port.

     Database Port [3306] 
     > 
  15. Enter your database name, user, and password.

     Database Name [database]:
     > 
     Database Login [root]:
     >
     Database Password []:
     >
  16. Enter your October CMS license key.

     License Key:
         >
  17. Installation will continue.

  18. When finished, migrate the database to initialise the tables.

     $ sudo php artisan october:migrate
  19. Complete your October CMS configuration from a web browser. Connect to the backend URL with your domain name or server's IP address. For example:

     http://YOUR_SERVER_IP_ADDRESS/backend 
     http://YOUR_DOMAIN/backend

Next Steps