How to Install October CMS on Debian 12

how to install october cms on ubuntu 22.04

October CMS is a content management system written in PHP using the Laravel web application framework. The data can be stored in different relational database management systems such as MySQL, PostgreSQL, SQLite etc.

October CMS covers a range of capabilities such as users, permissions, plugins, themes, and many more. In this blog post, we will install October CMS using the LEMP stack.

Installing October CMS on Debian 12 is a straightforward process that may take up to 15 minutes. Let’s get started!

Prerequisites

  • A server with Debian 12 as OS
  • User privileges: root or non-root user with sudo privileges
  • A valid domain with pointed A record to the server

Step 1. Update the System

Every fresh installation of Debian 12 requires the system packages to be updated to the latest versions available.

sudo apt-get update -y && sudo apt-get upgrade -y

Step 2. Install Nginx Webserver

To install the Nginx web server, execute the following command:

sudo apt install nginx -y

Once the installation is complete, check the status of the Nginx service:

systemctl status nginx

You should get the following output:

root@host:~# systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-08-08 13:35:28 CDT; 23s ago
       Docs: man:nginx(8)
    Process: 118520 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 118521 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 118614 (nginx)
      Tasks: 4 (limit: 4557)
     Memory: 4.0M
        CPU: 70ms
     CGroup: /system.slice/nginx.service

Step 3. Install MariaDB Database Server

Next to the LEMP stack is the MariaDB database server. To install MariaDB execute the following command:

sudo apt install mariadb-server -y

Once the installation is complete, start and enable the MariaDB service:

sudo systemctl start mariadb && sudo systemctl enable mariadb

Check the status of the mariadb.service

sudo systemctl status mariadb

You should receive the following output:

root@host:~# sudo systemctl status mariadb
● mariadb.service - MariaDB 10.6.12 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-08-08 13:43:09 CDT; 34s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 120012 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 15 (limit: 4557)
     Memory: 67.9M
        CPU: 824ms
     CGroup: /system.slice/mariadb.service
             └─120012 /usr/sbin/mariadbd

Step 4. Install PHP8.1 with dependencies

The last of the LEMP stack will be PHP. PHP8.1 is by default enabled in the Debian 12 repository, so to install PHP8.1 with extensions, execute the following commands:

sudo apt-get install php8.1 php8.1-cli php8.1-common php8.1-imap php8.1-redis php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-curl php8.1-mysqli php8.1-intl php8.1-bcmath php8.1-gd libapache2-mod-php php8.1-fpm -y

To check the installed PHP version execute the php -v command:

To check the installed PHP version, execute the following command:

php -v

You should get the following output:

root@host:~# php -v
PHP 8.1.2-1ubuntu2.13 (cli) (built: Jun 28 2023 14:01:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.13, Copyright (c), by Zend Technologies

Step 5. Create October CMS database and user

Next, we need to create an October CMS database, the October CMS user, and grant the permissions for that user to the database.

 CREATE USER 'octobercms'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';
 CREATE DATABASE octobercms;
 GRANT ALL PRIVILEGES ON octobercms.* TO 'octobercms'@'localhost';
 FLUSH PRIVILEGES;
 EXIT;

Step 6. Download and install the October CMS

Before we install October CMS, we first need to download it in the default Nginx document root:

cd /var/www/html

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

unzip october.zip

rm october.zip

mv install-master/ octobercms/

Set the right permissions to files and folders.

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

cd /var/www/html

find . -type d -exec chmod 755 {} \;

find . -type f -exec chmod 644 {} \;

Step 7. Create Nginx Configuration File

Go into the Nginx directory and create a configuration file for the October CMS.

cd /etc/nginx/conf.d

touch octobercms.conf

Open the file, paste the following lines of code, save the file, and close it.

server {
    listen 80;

    server_name YourDomainName;

    index index.php index.html;
    root /var/www/html/octobercms;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.1-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; }

}

Check the syntax:

nginx -t

You should receive the following output:

root@host:/etc/nginx/sites-enabled# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If the syntax is OK, restart the Nginx service.

systemctl reload nginx

Once the Nginx service is restarted, you can finish the October CMS installation at http://yourdomain.com/install.php

Step 8. Finish the Installation

On the first screen, click on “Agree and Continue” at the bottom of the page.

Then you need to enter the database credentials you created in the previous steps.

On the next window, we will click on Install without a License

You will need to allow some time for the installation to complete.

Congratulations! You successfully installed October CMS on Debian 12 and Nginx as a web server.

Please note that this software is not free, and your post-installation will ask you for a license key. More about this can be found on the official October CMS website. Of course, if you find some difficulties while installing October CMS, you can always contact our system admins, and with their expertise, they will install it for you. All you need to do is contact our support. We are available 24/7.

If you liked this post on how to install October CMS on Debian 12, please share it with your friends on social networks or simply leave a reply below. Thanks.

Leave a Comment