Joomla! 4.3 on OpenBSD 7.3: Install

nabbisen

nabbisen

Posted on September 5, 2023

Joomla! 4.3 on OpenBSD 7.3: Install

Summary

Joomla! is one of popular PHP 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 on OpenBSD, the solid OS. All of them are the latest as of today.

Environment

Reference posts

In case any of them are not done:

Notes on Joomla!'s system requirements

PHP 8.2 is not what is recommended officially by them today (See: their Technical Requirements). It got, however, "improved support" in 4.3 release, which is described in their "What’s new in Joomla 4.3.0 Stable?". 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).

Tutorial

Prepare database

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



-- 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;


Enter fullscreen mode Exit fullscreen mode

Install and activate PHP extensions

Get mysqli for MariaDB connection:



$ doas pkg_add php-mysqli


Enter fullscreen mode Exit fullscreen mode

The output, my choice and the result were:



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


Enter fullscreen mode Exit fullscreen mode

It is necessary to activate it (and also opcache). Run:



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


Enter fullscreen mode Exit fullscreen mode

Now they are activated:



$ 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


Enter fullscreen mode Exit fullscreen mode

Get Joomla! package

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

Run to download from their releases in GitHub:



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


Enter fullscreen mode Exit fullscreen mode

Decompress and extract it:



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


Enter fullscreen mode Exit fullscreen mode

Set permissions for web user:



$ doas chown -R www:www ./*


Enter fullscreen mode Exit fullscreen mode

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



$ doas nvim /etc/httpd.conf


Enter fullscreen mode Exit fullscreen mode

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).



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"
        } 
}


Enter fullscreen mode Exit fullscreen mode

Restart the daemon:



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


Enter fullscreen mode Exit fullscreen mode

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

TLS configuration files

It is able to get them via requests to Let's Encrypt with acme-client. (See: How to conifugre OpenBSD acme-client).

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



$ 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 </span>
-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
Enter fullscreen mode Exit fullscreen mode




Server without TLS connection (Optional)

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



# 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
Enter fullscreen mode Exit fullscreen mode




Servers with and without TLS connection (Optional)

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



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

Enter fullscreen mode Exit fullscreen mode




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

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

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 💫

💖 💪 🙅 🚩
nabbisen
nabbisen

Posted on September 5, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related