Joomla! 4.3 on OpenBSD 7.3: Install

Table of contents

Summary Summary

Joomla! (opens in a new tab) is one of popular PHP (opens in a new tab) content management systems (aka CMS). It is good for portal-like websites as well as blogging platforms. The first version was released in 2005 and, after long progress, the latest major one was done two years ago (on 2021-08-17).

This post shows how to install Joomla! with PHP/PHP-FPM (opens in a new tab) on OpenBSD (opens in a new tab), the solid OS. All of them are the latest as of today.

Environment Environment

Reference posts Reference posts

In case any of them are not done:

Notes on Joomla!’s system requirements Notes on Joomla!’s system requirements

PHP 8.2 is not what is recommended officially by them today (See: their Technical Requirements (opens in a new tab)). It got, however, “improved support” in 4.3 release, which is described in their “What’s new in Joomla 4.3.0 Stable?” (opens in a new tab). Therefore, PHP 8.2 should be a better option than 8.1 now. Besides, as to the other option, 8.0, its support will come to an end soon (See: PHP’s Supported Versions (opens in a new tab)).

Tutorial Tutorial

Prepare database Prepare database

Connect to the server with client tool (for example, running mysql -u root -p), and run:

sql
-- create database
CREATE DATABASE <dbname> \
    CHARACTER SET utf8mb4 \
    COLLATE utf8mb4_unicode_ci;

-- create user
GRANT ALL PRIVILEGES \
    ON <dbname>.* \
    TO <dbuser>@'localhost' \
    IDENTIFIED BY '<dbpass>';

-- flush
FLUSH PRIVILEGES;

Install and activate PHP extensions Install and activate PHP extensions

Get mysqli (opens in a new tab) for MariaDB connection:

console
$ doas pkg_add php-mysqli

The output, my choice and the result were:

console
quirks-6.122 signed on 2023-09-01T21:25:11Z
Ambiguous: choose package for php-mysqli
a	0: <None>
	1: php-mysqli-7.4.33
	2: php-mysqli-8.0.30
	3: php-mysqli-8.1.22
	4: php-mysqli-8.2.9
Your choice: 4
php-mysqli-8.2.9: ok

It is necessary to activate it (and also opcache (opens in a new tab)). Run:

console
$ doas ln -s /etc/php-8.2.sample/* /etc/php-8.2/

Now they are activated:

console
$ ls -l /etc/php-8.2
total 0
lrwxr-xr-x  1 root  wheel  30 Sep  2 10:09 mysqli.ini -> /etc/php-8.2.sample/mysqli.ini
lrwxr-xr-x  1 root  wheel  31 Sep  2 10:09 opcache.ini -> /etc/php-8.2.sample/opcache.ini

Get Joomla! package Get Joomla! package

Suppose that our working directory is /var/www/joomla.

Run to download from their releases (opens in a new tab) in GitHub:

console
$ curl -LO https://github.com/joomla/joomla-cms/releases/download/4.3.4/Joomla_4.3.4-Stable-Full_Package.tar.gz

Decompress and extract it:

console
$ tar xzf Joomla_4.3.4-Stable-Full_Package.tar.gz

Set permissions for web user:

console
$ doas chown -R www:www ./*

Add httpd (Web) server(s) Add httpd (Web) server(s)

If you don’t have the activated daemons of either httpd or PHP-FPM 8.2, you have to make them ready. (See Reference posts.)

If so, continue and add defition on Joomla! server(s):

console
$ doas nvim /etc/httpd.conf

Write like below in it. Here, <fqdn> is up to you. <chroot-parent-dir> must be empty. (It is up to your working directory.) In addition, TLS configuration files are necessary to enable TLS (see below).

apache
server "<fqdn>" {
        listen on egress tls port https
        tls {    
                certificate     "/etc/ssl/<fqdn>.crt"
                key             "/etc/ssl/private/<fqdn>.key"
        }
        log {
                access  "<fqdn>-access.log"
                error   "<fqdn>-error.log"
        }

        # it depends on your working directory under `/var/www` and `chroot` settings:
        root "<chroot-parent-dir>/joomla"
        directory index index.php

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

Restart the daemon:

console
$ doas rcctl restart httpd
httpd(ok)
httpd(ok)

Now we can access to Joomla!’s web installer with web browser. Connect to https://<fqdn>/ !!

TLS configuration files TLS configuration files

It is able to get them via requests to Let’s Encrypt (opens in a new tab) with acme-client (opens in a new tab). (See: How to conifugre OpenBSD acme-client).

Alternatively, you can get them as self-signed certificates with command lines such as:

console
$ cd /etc/ssl

$ # [ consts ]
$ # case ksh:
$ export MY_DOMAIN="..."
$ export MY_COUNTRY_CODE="XX"
$ export MY_STATE="..."
$ export MY_ORGANIZATION="..."
$ # case fish:
$ # set -x MY_DOMAIN "..."; (...)

$ # [ generate ]
$ doas openssl req -newkey rsa:2048 -new -nodes -x509 -days 36500 -keyout private/$MY_DOMAIN.key -out $MY_DOMAIN.crt \
    -subj "/C=$MY_COUNTRY_CODE/ST=$MY_STATE/L=/O=$MY_ORGANIZATION/OU=/CN=$MY_DOMAIN"
$ doas chmod 400 private/$MY_DOMAIN.key

$ # return to your working directory

Server without TLS connection (Optional) Server without TLS connection (Optional)

You may build another server which uses http instead of https (less secure):

diff
# httpd.conf
<         listen on egress tls port https
<         tls {    
<                 certificate     "/etc/ssl/<fqdn>.crt"
<                 key             "/etc/ssl/private/<fqdn>.key"
<         }
>         listen on egress port http

Servers with and without TLS connection (Optional) Servers with and without TLS connection (Optional)

In addition, you can also redirect all http requests to https as needed:

apache
# httpd.conf
server "<fqdn>" {
        listen on egress http
        # (...)
        block return 301 "https://$SERVER_NAME$REQUEST_URI"
}
server "<fqdn>" {
        listen on egress tls port https
        # (...)
}

Set it up with web installer Set it up with web installer

All you have to do is just follow them. Well, in my case, the <fqdn> above was 192.168.122.175.

Select default language and enter site name:

joomla-4-install-01

Create the system administrator:

joomla-4-install-02

Enter database information, and clicking the button will start the actual installation:

joomla-4-install-03

Success messages will be shown:

joomla-4-install-04

Validate installation Validate installation

You will see the front page when https://<fqdn>/ is accessed to:

joomla-4-home-01

The admin entrance will be shown with https://<fqdn>/administrator/ accessed to:

joomla-4-admin-01

When authentication is successful, the admin panel will be shown:

joomla-4-admin-02

Conclusion Conclusion

Now you are ready to build your website with the latest Joomla! Here shows an example about a very small step. Upload a media file in Media view:

joomla-4-media-01

Click “Upload” and choose a file. I tried one of the OpenBSD logos. It was successful :)

joomla-4-media-02

As shown in this post, it is not tough work to build and serve PHP apps on OpenBSD, when httpd and PHP-FPM are configured. It’s because their project and community support PHP and also components around web service.

🕊 Happy serving 💫

More on: Run PHP applications

OBSD Solutions

OBSD Solutions: OpenBSD consulting and support by Scqr, Reflerd Inc. (opens in a new tab)

Comments and feedback are welcome.