October CMS is a free, open-source, self-hosted CMS platform based on the Laravel PHP Framework. October CMS source code is hosted on Github. In this tutorial, we will walk you through the October CMS installation process on a Debian 9 (stretch) operating system by using NGINX as a web server, MariaDB as a database server, and optionally you can secure transport layer by using acme.sh client and Let's Encrypt certificate authority to add SSL support.

Requirements

Before you proceed, you should check that your server meets the minimum system requirements. October CMS has the following server requirements for web hosting:

  • PHP version 7.0 or higher
  • PHP PDO Extension
  • cURL PHP Extension
  • OpenSSL PHP Extension
  • Mbstring PHP Library
  • Zip PHP Library
  • GD PHP Library
  • XML PHP Extension
  • JSON PHP Extension
  • Apache with mod_rewrite or NGINX
  • Database server (MariaDB, MySQL, PostgreSQL)

Prerequisites

  • A system running Debian 9 (stretch).
  • A non-root user with sudo privileges.

Initial steps

Check your Debian system version:

lsb_release -ds
# Debian GNU/Linux 9.7 (stretch)

Set up the timezone:

dpkg-reconfigure tzdata

Update your operating system packages (software). This is an important first step because it ensures you have the latest updates and security fixes for your operating system's default software packages:

apt update && apt upgrade -y

Install some essential packages that are necessary for basic administration of the Debian operating system:

apt install -y curl wget vim git sudo unzip socat bash-completion dirmngr apt-transport-https

Step 1 - Install PHP and necessary PHP extensions

October CMS platform requires PHP version 7.0 or greater. By default Debian 9 has PHP version 7.0 in its default software repositories which is fine for October CMS. 

Install PHP, as well as the necessary PHP extensions:

sudo apt install -y php7.0 php7.0-cli php7.0-fpm php7.0-common php7.0-mysql php7.0-curl php7.0-json php7.0-zip php7.0-gd php7.0-xml php7.0-mbstring 

To show PHP compiled in modules, you can run:

php -m

ctype
curl
exif
fileinfo
. . .
. . .

Check the PHP version:

php --version

# PHP 7.0.33-0+deb9u1 (cli) (built: Dec  7 2018 11:36:49) ( NTS )
# Copyright (c) 1997-2017 The PHP Group
# Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
# with Zend OPcache v7.0.33-0+deb9u1, Copyright (c) 1999-2017, by Zend Technologies

PHP-FPM service is automatically started and enabled on reboot on Debian 9 system, so there is no need to start and enable it manually. We can move on to the next step, which is the database installation and setup.

Step 2 - Install MariaDB and create a database for October

October supports MySQL/MariaDB, PostgreSQL, SQLite, and SQL databases. Debian team replaced MySQL with MariaDB as the default database from Debian 9 (stretch), so in this tutorial, we will use MariaDB as the database server. If you want to install original MySQL you can add and use official MySQL repository maintained by Oracle.

Install MariaDB database server from the official MariaDB repo:

sudo apt install -y software-properties-common dirmngr apt-transport-https
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] https://mirrors.nxthost.com/mariadb/repo/10.2/debian stretch main'
sudo apt update
sudo apt install -y mariadb-server

Check the MariaDB version:

mysql --version
# mysql  Ver 15.1 Distrib 10.2.21-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Run mysql_secure installation script to improve MariaDB security and set the password for MariaDB root user:

sudo mysql_secure_installation

Answer each of the questions:

Enter current password for root (enter for none): Press Enter
Set root password? [Y/n] Y
New password: your_secure_password
Re-enter new password: your_secure_password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Log into MariaDB as the root user:

sudo mysql -u root -p
# Enter password

Create a MariaDB database and user that you will use for your installation of October, and remember the credentials:

CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

Exit from MariaDB shell:

quit

Step 3 - Install Acme.sh client and obtain Let's Encrypt certificate (optional)

Securing your website with HTTPS is not necessary, but it is a good practice to secure your site traffic. In order to obtain an SSL certificate from Let's Encrypt we will use Acme.sh client. Acme.sh is a pure UNIX shell software for obtaining SSL certificates from Let's Encrypt with zero dependencies. 

Download and install Acme.sh:

sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh 
./acme.sh --install --accountemail your_email@example.com
source ~/.bashrc
cd ~

Check acme.sh version:

acme.sh --version
# v2.8.0

Obtain RSA and ECC/ECDSA certificates for your domain/hostname:

# RSA 2048
acme.sh --issue --standalone -d example.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d example.com --keylength ec-256

If you want fake certificates for testing you can add --staging flag to the above commands.

After running the above commands, your certificates and keys will be in:

  • For RSA~/example.com directory.
  • For ECC/ECDSA~/example.com_ecc directory.

To list your issued certs you can run:

acme.sh --list

Create a directory to store your certs. We will use /etc/letsencrypt directory.

mkdir -p /etc/letsencrypt/example.com
sudo mkdir -p /etc/letsencrypt/example.com_ecc

Install/copy certificates to /etc/letsencrypt directory.

# RSA
acme.sh --install-cert -d example.com \
--cert-file /etc/letsencrypt/example.com/cert.pem \
--key-file /etc/letsencrypt/example.com/private.key \
--fullchain-file /etc/letsencrypt/example.com/fullchain.pem \
--reloadcmd "sudo systemctl reload nginx.service"

# ECC/ECDSA
acme.sh --install-cert -d example.com --ecc \
--cert-file /etc/letsencrypt/example.com_ecc/cert.pem \
--key-file /etc/letsencrypt/example.com_ecc/private.key \
--fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem \
--reloadcmd "sudo systemctl reload nginx.service"

All the certificates will be automatically renewed every 60 days.

After obtaining certs, exit from root user and return back to normal sudo user:

exit

Step 4 - Install NGINX and configure NGINX for October

Install NGINX web server:

sudo apt install -y nginx

Check the NGINX version:

sudo nginx -v
# nginx version: nginx/1.10.3

Configure NGINX for October by running:

sudo vim /etc/nginx/sites-available/october.conf

And populate the file with the following configuration:

server {
listen [::]:443 ssl http2;
listen 443 ssl http2; listen [::]:80; listen 80; server_name example.com; index index.php index.html; root /var/www/october;
ssl_certificate /etc/letsencrypt/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com/private.key;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key;
location / { try_files $uri $uri/ /index.php?$query_string; }

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_read_timeout 120s;
}

location ~ ^/favicon\.ico { try_files $uri /index.php; }
location ~ ^/sitemap\.xml { try_files $uri /index.php; }
location ~ ^/robots\.txt { try_files $uri /index.php; }
location ~ ^/humans\.txt { try_files $uri /index.php; }
location ~ ^/storage/app/uploads/public { try_files $uri 404; }
location ~ ^/storage/app/media { try_files $uri 404; }
location ~ ^/storage/temp/public { try_files $uri 404; }
location ~ ^/modules/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/behaviors/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/behaviors/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/widgets/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/widgets/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/formwidgets/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/formwidgets/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/reportwidgets/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/reportwidgets/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/behaviors/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/behaviors/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/reportwidgets/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/reportwidgets/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/formwidgets/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/formwidgets/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/widgets/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/widgets/.*/resources { try_files $uri 404; }
location ~ ^/themes/.*/assets { try_files $uri 404; }
location ~ ^/themes/.*/resources { try_files $uri 404; } }

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

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

Check NGINX configuration for syntax errors:

sudo nginx -t

Reload NGINX service:

sudo systemctl reload nginx.service

Step 5 - Download and install October CMS platform

Create a document root directory:

sudo mkdir -p /var/www/october

Change ownership of the /var/www/october directory to [your_user]:

sudo chown -R [your_user]:[your_user] /var/www/october

Navigate to document root:

cd /var/www/october

Download the October CMS installer:

wget https://octobercms.com/download -O october.zip

Unzip October CMS installer:

unzip october.zip
rm october.zip
mv install-master/* .

Change ownership of the /var/www/october directory to www-data:

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

Navigate to the install.php script in your web browser, like example.com/install.php and follow the installation instructions.

Step 6 - Complete the October setup

Make sure your System Check is ok, and proceed by pressing "Agree & Continue" button.

Configure your database and admin user settings.

You can also configure some advanced settings or you can leave the default values.

And finally when everything is configured press blue "Continue" button.

Next, you will be asked "How do you want to set up your site?". You will have 3 options: Start from scratchStart from a themeUse a project ID. Select your preferred option.

To access administration area of October CMS platform, just append /backend to your URL/IP.

After the installation, for security reasons you should delete the installation files, the install.php script and the install_files directory:

sudo rm /var/www/october/install.php && sudo rm -rf /var/www/october/install_files

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)