How to Install October CMS platform on CentOS 7

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 fresh CentOS 7 server.

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 greater
  • 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
  • A server running CentOS 7.
  • A non-root user with sudo privileges.

Initial steps

Check your CentOS system version:

cat /etc/centos-release
# CentOS Linux release 7.5.1804 (Core)

Set up the timezone:

timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'

Update your operating system’s packages:

sudo yum update -y

Install vim, git, unzip, and socat packages:

sudo yum install -y vim git unzip socat

Step 1 – Install PHP

October CMS platform requires PHP version 7.0 or greater. Default CentOS repositories contian older version of PHP, and thus we will need to setup a third-party repository to install a newer PHP version. We will use Webtatic repository.

Setup the Webtatic YUM repo:

sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Install PHP, as well as the necessary PHP extensions:

sudo yum install -y php72w-cli php72w-fpm php72w-pdo php72w-common php72w-mysql php72w-curl php72w-json php72w-zip php72w-gd php72w-xml php72w-mbstring 

Check the PHP version:

php --version

# PHP 7.2.11 (cli) (built: Oct 11 2018 19:14:35) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies # with Zend OPcache v7.2.9, Copyright (c) 1999-2018, by Zend Technologies

Start and enable PHP-FPM service:

sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.service

Step 2 – Install MariaDB and create a database for October

Install MariaDB database server:

sudo yum install -y mariadb-server

Check the MariaDB version:

mysql --version
# mysql Ver 15.1 Distrib 5.5.60-MariaDB, for Linux (x86_64) using readline 5.1

Start and enable MariaDB service:

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

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

mysql_secure_installation

Log into MariaDB as the root user:

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 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 mkdir /etc/letsencrypt
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh 
sudo ./acme.sh --install --home /etc/letsencrypt --accountemail [email protected]
cd ~

Check Acme.sh version:

/etc/letsencrypt/acme.sh --version
# v2.8.0

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

# RSA 2048
sudo /etc/letsencrypt/acme.sh --issue --standalone --home /etc/letsencrypt -d example.com --keylength 2048
# ECDSA
sudo /etc/letsencrypt/acme.sh --issue --standalone --home /etc/letsencrypt -d example.com --keylength ec-256

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

  • For RSA: /etc/letsencrypt/example.com directory.
  • For ECC/ECDSA: /etc/letsencrypt/example.com_ecc directory.

Step 4 – Install and configure Nginx

Install Nginx webserver:

sudo yum install -y nginx

Check the NGINX version:

nginx -v
# nginx version: nginx/1.12.2

Start and enable Nginx service:

sudo systemctl start nginx.service
sudo systemctl enable nginx.service

Run sudo vim /etc/nginx/conf.d/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.cer;
ssl_certificate_key /etc/letsencrypt/example.com/example.com.key;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/example.com.key;
location / { try_files $uri /index.php$is_args$args; } location ~ \.php$ { include fastcgi.conf; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_read_timeout 120s; } rewrite ^themes/.*/(layouts|pages|partials)/.*.htm /index.php break; rewrite ^bootstrap/.* /index.php break; rewrite ^config/.* /index.php break; rewrite ^vendor/.* /index.php break; rewrite ^storage/cms/.* /index.php break; rewrite ^storage/logs/.* /index.php break; rewrite ^storage/framework/.* /index.php break; rewrite ^storage/temp/protected/.* /index.php break; rewrite ^storage/app/uploads/protected/.* /index.php break; }

Test the NGINX configuration.

sudo nginx -t

Reload NGINX.

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 johndoe:

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

Navigate to document root:

cd /var/www/october

Download the October CMS installer:

wget http://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 nginx:

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

Run sudo vim /etc/php-fpm.d/www.conf and set the user and group to nginx. Initially, they will be set to apache:

sudo vim /etc/php-fpm.d/www.conf
# user = nginx
# group = nginx

Restart the PHP-FPM service:

sudo systemctl restart php-fpm.service

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 procceed by pressing “Agree & Continue” button.

October CMS setup

Configure your database and admin user settings.

Database settings

Administrator user setup

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

Advanced settings

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 scratch, Start from a theme, Use a project ID. Select your prefered option.

Getting Started with October CMS

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

Links

نوشته های مشابه