October CMS on OpenBSD
Tags: octobercms, cms, laravel, openbsd
Published: 2019-10-06 04:23:51

---
title: October CMS on OpenBSD
published: true
description: October is CMS platform based on PHP Laravel framework. This post is about my installing it in OpenBSD, my favorite OS.
tags: octobercms, cms, laravel, openbsd
---

## Summary

[October](https://octobercms.com/) is a CMS platform based on [PHP](https://php.net/) [Laravel](https://laravel.com/) framework.

I was interested in it when I got to know it has core auto updates like [WordPress](https://wordpress.com/).
Also, I had been interested in Laravel, which I had never used and read about those by the users saying it is great.

This post is about my installing it in [OpenBSD](https://www.openbsd.org), my favorite OS :)

#### Environments

- OS: OpenBSD 6.5
- Database: [MariaDB](https://mariadb.org/) 10.0
- Web Server: OpenBSD [httpd](https://man.openbsd.org/httpd.conf)
- App Server: PHP 7.3
    - CGI: [PHP-FPM](https://php-fpm.org/)
    - Package Manager: [Composer](https://getcomposer.org/)
- CMS: October 1.0.459
    - based on Laravel: 5.5
    - requires PHP 7.0 or greater

The minimum system requirements is [here](https://octobercms.com/docs/setup/installation#system-requirements).

## Steps of installation

### #1. Database

Database type options are [MySQL](https://www.mysql.com/), [PostgreSQL](https://www.postgresql.org/), [SQLite3](https://www.sqlite.org/index.html) or [MS SQL Server](https://www.microsoft.com/sql-server).
I use MariaDB, a nice folk of MySQL.

Create a database and a user with such statements:

```sql
CREATE DATABASE <database> CHARACTER SET = 'utf8mb4';
GRANT ALL PRIVILEGES ON <database>.* TO <dbuser> IDENTIFIED BY '<dbpass>';
FLUSH PRIVILEGES;
```

### #2. Application

First, prepare "`php`" executable, for `php-7.3` isn't available on the way:

```console
# ln -s /usr/local/bin/php-7.3 /usr/local/bin/php
```

Prepare a directory:

```console
$ mkdir <october-dir>
$ cd <october-dir>
```

Get the modules:

```console
$ curl -s https://octobercms.com/api/installer | php
$ # Alternatively, if `curl` isn't available:
$ # php -r "eval('?>'.file_get_contents('https://octobercms.com/api/installer'));"
```

Soon, subdirectories are created:

```console
$ ls # in <october-dir>
artisan    config     modules    server.php themes
bootstrap  index.php  plugins    storage    vendor
```

Let's install via command lines according to [the official tutorial](https://octobercms.com/docs/console/commands#console-install
).


*\* Note: If you prefer GUI to CLI, [wizard web server is available](https://octobercms.com/docs/setup/installation#wizard-installation). With wzard installation, don't forget to delete both `install.php` and `install_files/` for security reasons.*

In order to install October, use Laravel's [Artisan](https://laravel.com/docs/5.8/artisan):

```console
$ php artisan october:install
```

The installer will start:

```console
.====================================================================.
                                                                      
 .d8888b.   .o8888b.   db  .d8888b.  d8888b. d88888b d8888b.  .d888b. 
.8P    Y8. d8P    Y8   88 .8P    Y8. 88  `8D 88'     88  `8D .8P , Y8.
88      88 8P      oooo88 88      88 88oooY' 88oooo  88oobY' 88  |  88
88      88 8b      ~~~~88 88      88 88~~~b. 88~~~~  88`8b   88  |/ 88
`8b    d8' Y8b    d8   88 `8b    d8' 88   8D 88.     88 `88. `8b | d8'
 `Y8888P'   `Y8888P'   YP  `Y8888P'  Y8888P' Y88888P 88   YD  `Y888P' 
                                                                      
`=========================== INSTALLATION ==========================='
```

Configure database:

```Console
 Database type:
  [0] MySQL
  [1] Postgres
  [2] SQLite
  [3] SQL Server
 > 

 MySQL Host [localhost]:
 > 127.0.0.1

 MySQL Port [3306]:
 > 

 Database Name []:
 > <database>

 MySQL Login []:
 > <dbuser>

 MySQL Password []:
 > <dbpass>
```

Set up the admin user:

```console
Enter a new value, or press ENTER for the default

 First Name [Admin]:
 > 

 Last Name [Person]:
 > 

 Email Address [admin@domain.tld]:
 > 

 Admin Login [admin]:
 > 

 Admin Password [admin]:
 > 
```

Confirm them:

```console
 Is the information correct? (yes/no) [yes]:
 > 
```

Enter server url:

```console
 Application URL []:
 > https://<fqdn>
```

How about advaned configuration?
I proceed in order to change the address of the backend, in a word, "administration":

```console
 Configure advanced options? (yes/no) [no]:
 > yes
```

Skip it:

```console
Enter a new value of 32 characters, or press ENTER to use the generated key

 Application key []:
 > 

Application key [] set successfully.
```

Edit the address of the backend:

```console
 Backend URL [backend]:
 > 
```

Skip them:

```console
 File Permission Mask [777]:
 > 

 Folder Permission Mask [777]:
 > 

 Enable Debug Mode? (yes/no) [yes]:
 > 

 Install the October.Drivers plugin? (yes/no) [no]:
 > 

 Install the Rainlab.Builder plugin? (yes/no) [no]:
 > 
```

Then the goal is almost there:

```console
Migrating application and plugins...
System
 - Nothing to migrate.
Backend
 - Nothing to migrate.
Cms
 - Nothing to migrate.
October.Demo
- Nothing to update.
.=========================================.
                ,@@@@@@@,                  
        ,,,.   ,@@@@@@/@@,  .oo8888o.      
     ,&%%&%&&%,@@@@@/@@@@@@,8888\88/8o     
    ,%&\%&&%&&%,@@@\@@@/@@@88\88888/88'    
    %&&%&%&/%&&%@@\@@/ /@@@88888\88888'    
    %&&%/ %&%%&&@@\ V /@@' `88\8 `/88'     
    `&%\ ` /%&'    |.|        \ '|8'       
        |o|        | |         | |         
        |.|        | |         | |         
`========= INSTALLATION COMPLETE ========='
```

You may want to make additional configuration by editing config/app.php or config/cms.php.

Well, verify files are writable for web user:

```console
# # For example:
# chmod -R g+w .
```

Finally, thank you and so long, "`php`" executable:

```console
# rm /usr/local/bin/php
```

### #3. Web server

Edit conf:

```console
# nvim /etc/httpd.conf
```

like:

```apache
server "<fqdn>" {
        listen on $ext_addr tls port 443
        tls {
                certificate     "/etc/ssl/<fqdn>.fullchain.pem"
                key             "/etc/ssl/private/<fqdn>.key"
        }
        log {
                access  "<fqdn>-access.log"
                error   "<fqdn>-error.log"
        }

        root "/<october-dir>"
        directory index index.php

        location "/*.php" { 
                fastcgi socket "/run/php-fpm.sock"
        } 
        location "/*.php[/?]*" { 
                fastcgi socket "/run/php-fpm.sock"
        }
}
```

Restart the daemon:

```console
# rcctl restart httpd
```

## Conclusion

#### Screenshots

##### Frontend

`https://<fqdn>/index.php`:

![frontend](https://thepracticaldev.s3.amazonaws.com/i/kbfz8wnzod3hhatl1gz2.png)

##### Backend

`https://<fqdn>/index.php/<backend>`:

![backend](https://thepracticaldev.s3.amazonaws.com/i/52nnyw2uabgjqxs8knq8.png)

They look cool :)