Mark's random ramblings

Setting up Matomo (formerly Piwik) in a FreeBSD jail

I have a series of light-weight jails set up in FreeBSD for various purposes.

There is a number of ways to set up FreeBSD jails so I won't go in to any of them. I tend to set them up manually to have more control but that's purely optional.

I've created a jail on the primary web server called analytics.legios.org that to run Matomo. To do this I have installed nginx and matomo1)

If you are running an internal DNS server and/or a reverse proxy you should set up the correct DNS records and update the reverse proxy to reflect the new jail, as well as updating your external DNS config to register the new subdomain.

Installing Matomo and nginx (and mysql/mariadb104 in this example)

Since there are flavours of matomo you'll notice that I'm installing the php 7.3 version

# pkg install nginx php73-matomo

This will present something like this:2)

Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating 1.pkg.legios.org repository catalogue...
1.pkg.legios.org repository is up to date.
All repositories are up to date.
The following 55 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        nginx: 1.16.1,2 [1.pkg.legios.org]
        php73-matomo: 3.9.1_1 [FreeBSD]
        php73-tidy: 7.3.8 [FreeBSD]
        tidy-lib: 090315.c_3 [FreeBSD]
        php73: 7.3.8 [FreeBSD]
        perl5.30: 5.30.0 [FreeBSD]
        mariadb104-client: 10.4.6 [FreeBSD]
        libargon2: 20171227_1 [FreeBSD]
        pcre2: 10.32_1 [FreeBSD]
        php73-session: 7.3.8 [FreeBSD]
        php73-opcache: 7.3.8 [FreeBSD]
        php73-xml: 7.3.8 [FreeBSD]
        php73-simplexml: 7.3.8 [FreeBSD]
        php73-dom: 7.3.8 [FreeBSD]
        php73-ctype: 7.3.8 [FreeBSD]
        php73-posix: 7.3.8 [FreeBSD]
        php73-fileinfo: 7.3.8 [FreeBSD]
        php73-openssl: 7.3.8 [FreeBSD]
        php73-hash: 7.3.8 [FreeBSD]
        php73-filter: 7.3.8 [FreeBSD]
        php73-pecl-mcrypt: 1.0.2 [FreeBSD]
        libmcrypt: 2.5.8_3 [FreeBSD]
        libltdl: 2.4.6 [FreeBSD]
        php73-sockets: 7.3.8 [FreeBSD]
        php73-soap: 7.3.8 [FreeBSD]
        php73-bcmath: 7.3.8 [FreeBSD]
        php73-gd: 7.3.8 [FreeBSD]
        png: 1.6.37 [FreeBSD]
        jpeg-turbo: 2.0.2 [FreeBSD]
        libgd: 2.2.5_1,1 [1.pkg.legios.org]
        webp: 1.0.2 [FreeBSD]
        tiff: 4.0.10_1 [FreeBSD]
        jbigkit: 2.1_1 [FreeBSD]
        php73-curl: 7.3.8 [FreeBSD]
        php73-tokenizer: 7.3.8 [FreeBSD]
        php73-readline: 7.3.8 [FreeBSD]
        php73-json: 7.3.8 [FreeBSD]
        php73-intl: 7.3.8 [FreeBSD]
        php73-sqlite3: 7.3.8 [FreeBSD]
        sqlite3: 3.28.0 [FreeBSD]
        php73-pdo_mysql: 7.3.8 [FreeBSD]
        php73-pdo: 7.3.8 [FreeBSD]
        php73-mysqli: 7.3.8 [FreeBSD]
        php73-memcache: 4.0.4 [FreeBSD]
        php73-zlib: 7.3.8 [FreeBSD]
        php73-mbstring: 7.3.8 [FreeBSD]
        oniguruma: 6.9.2 [FreeBSD]
        php73-iconv: 7.3.8 [FreeBSD]
        php73-zip: 7.3.8 [FreeBSD]
        libzip: 1.5.2 [FreeBSD]
        php73-bz2: 7.3.8 [FreeBSD]
        libxslt: 1.1.33 [1.pkg.legios.org]
        libmaxminddb: 1.3.2_2 [1.pkg.legios.org]
        google-perftools: 2.7_1 [1.pkg.legios.org]
        libunwind: 20170615 [1.pkg.legios.org]

Number of packages to be installed: 55

The process will require 213 MiB more space.
40 MiB to be downloaded.

Proceed with this action? [y/N]:

You should hit y then hit enter3)

This might take some time depending on your internet connection and/or local package build setup if you have one.

[analytics.legios.org] [1/55] Fetching nginx-1.16.1,2.txz: 100%  477 KiB 488.4kB/s    00:01
[analytics.legios.org] [2/55] Fetching php73-matomo-3.9.1_1.txz: 100%   12 MiB 220.9kB/s    00:58
[analytics.legios.org] [3/55] Fetching php73-tidy-7.3.8.txz: 100%   16 KiB  16.1kB/s    00:01
[analytics.legios.org] [4/55] Fetching tidy-lib-090315.c_3.txz: 100%  264 KiB 135.3kB/s    00:02
[analytics.legios.org] [5/55] Fetching php73-7.3.8.txz: 100%    3 MiB 177.2kB/s    00:20
[analytics.legios.org] [6/55] Fetching perl5.30-5.30.0.txz: 100%   14 MiB 247.9kB/s    00:59
[analytics.legios.org] [7/55] Fetching mariadb104-client-10.4.6.txz: 100%    1 MiB 249.0kB/s    00:06
[analytics.legios.org] [8/55] Fetching libargon2-20171227_1.txz: 100%   65 KiB  66.1kB/s    00:01
[analytics.legios.org] [9/55] Fetching pcre2-10.32_1.txz: 100%    1 MiB 313.4kB/s    00:04
[analytics.legios.org] [10/55] Fetching php73-session-7.3.8.txz: 100%   35 KiB  36.0kB/s    00:01
[analytics.legios.org] [11/55] Fetching php73-opcache-7.3.8.txz: 100%  184 KiB 188.6kB/s    00:01
[analytics.legios.org] [12/55] Fetching php73-xml-7.3.8.txz: 100%   20 KiB  20.5kB/s    00:01
[analytics.legios.org] [13/55] Fetching php73-simplexml-7.3.8.txz: 100%   23 KiB  23.3kB/s    00:01
[analytics.legios.org] [14/55] Fetching php73-dom-7.3.8.txz: 100%   54 KiB  55.7kB/s    00:01
[analytics.legios.org] [15/55] Fetching php73-ctype-7.3.8.txz: 100%    6 KiB   6.1kB/s    00:01
[analytics.legios.org] [16/55] Fetching php73-posix-7.3.8.txz: 100%   12 KiB  12.3kB/s    00:01
[analytics.legios.org] [17/55] Fetching php73-fileinfo-7.3.8.txz: 100%  253 KiB 259.4kB/s    00:01
[analytics.legios.org] [18/55] Fetching php73-openssl-7.3.8.txz: 100%   54 KiB  55.5kB/s    00:01
[analytics.legios.org] [19/55] Fetching php73-hash-7.3.8.txz: 100%  149 KiB 152.7kB/s    00:01
[analytics.legios.org] [20/55] Fetching php73-filter-7.3.8.txz: 100%   19 KiB  19.7kB/s    00:01
[analytics.legios.org] [21/55] Fetching php73-pecl-mcrypt-1.0.2.txz: 100%   15 KiB  15.1kB/s    00:01
[analytics.legios.org] [22/55] Fetching libmcrypt-2.5.8_3.txz: 100%  120 KiB 122.9kB/s    00:01
[analytics.legios.org] [23/55] Fetching libltdl-2.4.6.txz: 100%   37 KiB  38.2kB/s    00:01
[analytics.legios.org] [24/55] Fetching php73-sockets-7.3.8.txz: 100%   36 KiB  37.1kB/s    00:01
[analytics.legios.org] [25/55] Fetching php73-soap-7.3.8.txz: 100%  111 KiB 113.2kB/s    00:01
[analytics.legios.org] [26/55] Fetching php73-bcmath-7.3.8.txz: 100%   20 KiB  20.2kB/s    00:01
[analytics.legios.org] [27/55] Fetching php73-gd-7.3.8.txz: 100%   29 KiB  29.9kB/s    00:01
[analytics.legios.org] [28/55] Fetching png-1.6.37.txz: 100%  286 KiB 293.2kB/s    00:01
[analytics.legios.org] [29/55] Fetching jpeg-turbo-2.0.2.txz: 100%  344 KiB 351.8kB/s    00:01
[analytics.legios.org] [30/55] Fetching libgd-2.2.5_1,1.txz: 100%  200 KiB 205.0kB/s    00:01
[analytics.legios.org] [31/55] Fetching webp-1.0.2.txz: 100%  410 KiB 209.9kB/s    00:02
[analytics.legios.org] [32/55] Fetching tiff-4.0.10_1.txz: 100%  830 KiB 283.4kB/s    00:03
[analytics.legios.org] [33/55] Fetching jbigkit-2.1_1.txz: 100%   74 KiB  75.6kB/s    00:01
[analytics.legios.org] [34/55] Fetching php73-curl-7.3.8.txz: 100%   30 KiB  30.5kB/s    00:01
[analytics.legios.org] [35/55] Fetching php73-tokenizer-7.3.8.txz: 100%    9 KiB   9.4kB/s    00:01
[analytics.legios.org] [36/55] Fetching php73-readline-7.3.8.txz: 100%   13 KiB  13.0kB/s    00:01
[analytics.legios.org] [37/55] Fetching php73-json-7.3.8.txz: 100%   21 KiB  22.0kB/s    00:01
[analytics.legios.org] [38/55] Fetching php73-intl-7.3.8.txz: 100%  122 KiB 124.5kB/s    00:01
[analytics.legios.org] [39/55] Fetching php73-sqlite3-7.3.8.txz: 100%   18 KiB  18.2kB/s    00:01
[analytics.legios.org] [40/55] Fetching sqlite3-3.28.0.txz: 100%    1 MiB 280.3kB/s    00:05
[analytics.legios.org] [41/55] Fetching php73-pdo_mysql-7.3.8.txz: 100%   16 KiB  16.8kB/s    00:01
[analytics.legios.org] [42/55] Fetching php73-pdo-7.3.8.txz: 100%   45 KiB  46.1kB/s    00:01
[analytics.legios.org] [43/55] Fetching php73-mysqli-7.3.8.txz: 100%   40 KiB  41.3kB/s    00:01
[analytics.legios.org] [44/55] Fetching php73-memcache-4.0.4.txz: 100%   40 KiB  40.7kB/s    00:01
[analytics.legios.org] [45/55] Fetching php73-zlib-7.3.8.txz: 100%   17 KiB  17.8kB/s    00:01
[analytics.legios.org] [46/55] Fetching php73-mbstring-7.3.8.txz: 100%  741 KiB 252.9kB/s    00:03
[analytics.legios.org] [47/55] Fetching oniguruma-6.9.2.txz: 100%  212 KiB 217.5kB/s    00:01
[analytics.legios.org] [48/55] Fetching php73-iconv-7.3.8.txz: 100%   18 KiB  18.1kB/s    00:01
[analytics.legios.org] [49/55] Fetching php73-zip-7.3.8.txz: 100%   21 KiB  21.0kB/s    00:01
[analytics.legios.org] [50/55] Fetching libzip-1.5.2.txz: 100%  203 KiB 207.5kB/s    00:01
[analytics.legios.org] [51/55] Fetching php73-bz2-7.3.8.txz: 100%   11 KiB  10.8kB/s    00:01
[analytics.legios.org] [52/55] Fetching libxslt-1.1.33.txz: 100%  232 KiB 237.3kB/s    00:01
[analytics.legios.org] [53/55] Fetching libmaxminddb-1.3.2_2.txz: 100%   36 KiB  36.6kB/s    00:01
[analytics.legios.org] [54/55] Fetching google-perftools-2.7_1.txz: 100%  351 KiB 359.0kB/s    00:01
[analytics.legios.org] [55/55] Fetching libunwind-20170615.txz: 100%  118 KiB 120.6kB/s    00:01
Checking integrity... done (1 conflicting)
  - mariadb104-client-10.4.6 [FreeBSD] conflicts with mariadb101-client-10.1.41 [installed] on /usr/local/bin/msql2mysql
Checking integrity... done (0 conflicting)
Conflicts with the existing packages have been found.
One more solver iteration is needed to resolve them.
The following 54 package(s) will be affected (of 0 checked):

As you can see firstly, my internet connection isn't very fast (I'm updating some Steam games while typing this), but you'll notice I got a conflict. I've got mariadb101-client-10.1.41 installed because I have icinga2 installed in to my jail and it's built against mariadb101-client-10.1.41. Luckily I've updated Poudriere to use

mariadb104-client

these days so I need to just update icinga2 by running pkg upgrade icinga2 which shows:

Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating 1.pkg.legios.org repository catalogue...
1.pkg.legios.org repository is up to date.
All repositories are up to date.
The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        icinga2: 2.10.5_1 [1.pkg.legios.org]
        monitoring-plugins: 2.2_7 [1.pkg.legios.org]
        mariadb104-client: 10.4.6_1 [1.pkg.legios.org]

Number of packages to be installed: 3

The process will require 56 MiB more space.
8 MiB to be downloaded.

Proceed with this action? [y/N]: y
[analytics.legios.org] [1/3] Fetching icinga2-2.10.5_1.txz: 100%    6 MiB   6.6MB/s    00:01
[analytics.legios.org] [2/3] Fetching monitoring-plugins-2.2_7.txz: 100%  400 KiB 409.5kB/s    00:01
[analytics.legios.org] [3/3] Fetching mariadb104-client-10.4.6_1.txz: 100%    1 MiB   1.5MB/s    00:01
Checking integrity... done (0 conflicting)
[analytics.legios.org] [1/3] Installing mariadb104-client-10.4.6_1...
[analytics.legios.org] [1/3] Extracting mariadb104-client-10.4.6_1: 100%
[analytics.legios.org] [2/3] Installing monitoring-plugins-2.2_7...
[analytics.legios.org] [2/3] Extracting monitoring-plugins-2.2_7: 100%
[analytics.legios.org] [3/3] Installing icinga2-2.10.5_1...
===> Creating groups.
Using existing group 'icinga'.
===> Creating users
Using existing user 'icinga'.
[analytics.legios.org] [3/3] Extracting icinga2-2.10.5_1: 100%
Message from mariadb104-client-10.4.6_1:

************************************************************************

MariaDB respects hier(7) and doesn't check /etc and /etc/mysql for
my.cnf. Please move existing my.cnf files from those paths to
/usr/local/etc and /usr/local/etc/mysql.

************************************************************************
Message from icinga2-2.10.5_1:

If you do a major upgrade of Icinga 2 and use a database, please see
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/upgrading-icinga-2
how to upgrade the database.

To rotate Icinga 2's logfiles, you can copy /usr/local/share/examples/icinga2/newsyslog/icinga2.conf
to /usr/local/etc/newsyslog.conf.d/

Now I can proceed with

pkg install nginx php73-matomo

This will now show:

Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating 1.pkg.legios.org repository catalogue...
1.pkg.legios.org repository is up to date.
All repositories are up to date.
pkg: No packages available to install matching 'matomo' have been found in the repositories
jailed:[root@analytics.legios.org:/] pkg install php73-matomo
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating 1.pkg.legios.org repository catalogue...
1.pkg.legios.org repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 48 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        php73-matomo: 3.9.1_1 [FreeBSD]
        php73-tidy: 7.3.8 [FreeBSD]
        tidy-lib: 090315.c_3 [FreeBSD]
        php73: 7.3.8 [FreeBSD]
        libargon2: 20171227_1 [FreeBSD]
        pcre2: 10.32_1 [FreeBSD]
        php73-session: 7.3.8 [FreeBSD]
        php73-opcache: 7.3.8 [FreeBSD]
        php73-xml: 7.3.8 [FreeBSD]
        php73-simplexml: 7.3.8 [FreeBSD]
        php73-dom: 7.3.8 [FreeBSD]
        php73-ctype: 7.3.8 [FreeBSD]
        php73-posix: 7.3.8 [FreeBSD]
        php73-fileinfo: 7.3.8 [FreeBSD]
        php73-openssl: 7.3.8 [FreeBSD]
        php73-hash: 7.3.8 [FreeBSD]
        php73-filter: 7.3.8 [FreeBSD]
        php73-pecl-mcrypt: 1.0.2 [FreeBSD]
        libmcrypt: 2.5.8_3 [FreeBSD]
        libltdl: 2.4.6 [FreeBSD]
        php73-sockets: 7.3.8 [FreeBSD]
        php73-soap: 7.3.8 [FreeBSD]
        php73-bcmath: 7.3.8 [FreeBSD]
        php73-gd: 7.3.8 [FreeBSD]
        png: 1.6.37 [FreeBSD]
        jpeg-turbo: 2.0.2 [FreeBSD]
        libgd: 2.2.5_1,1 [1.pkg.legios.org]
        webp: 1.0.2 [FreeBSD]
        tiff: 4.0.10_1 [FreeBSD]
        jbigkit: 2.1_1 [FreeBSD]
        php73-curl: 7.3.8 [FreeBSD]
        php73-tokenizer: 7.3.8 [FreeBSD]
        php73-readline: 7.3.8 [FreeBSD]
        php73-json: 7.3.8 [FreeBSD]
        php73-intl: 7.3.8 [FreeBSD]
        php73-sqlite3: 7.3.8 [FreeBSD]
        sqlite3: 3.28.0 [FreeBSD]
        php73-pdo_mysql: 7.3.8 [FreeBSD]
        php73-pdo: 7.3.8 [FreeBSD]
        php73-mysqli: 7.3.8 [FreeBSD]
        php73-memcache: 4.0.4 [FreeBSD]
        php73-zlib: 7.3.8 [FreeBSD]
        php73-mbstring: 7.3.8 [FreeBSD]
        oniguruma: 6.9.2 [FreeBSD]
        php73-iconv: 7.3.8 [FreeBSD]
        php73-zip: 7.3.8 [FreeBSD]
        libzip: 1.5.2 [FreeBSD]
        php73-bz2: 7.3.8 [FreeBSD]

Number of packages to be installed: 48

The process will require 114 MiB more space.

Proceed with this action? [y/N]:

Now it will be safe to hit y then hit enter

Now you'll see:

[analytics.legios.org] [1/48] Installing jpeg-turbo-2.0.2...
[analytics.legios.org] [1/48] Extracting jpeg-turbo-2.0.2: 100%
[analytics.legios.org] [2/48] Installing jbigkit-2.1_1...
[analytics.legios.org] [2/48] Extracting jbigkit-2.1_1: 100%
[analytics.legios.org] [3/48] Installing libargon2-20171227_1...
[analytics.legios.org] [3/48] Extracting libargon2-20171227_1: 100%
[analytics.legios.org] [4/48] Installing pcre2-10.32_1...
[analytics.legios.org] [4/48] Extracting pcre2-10.32_1: 100%
[analytics.legios.org] [5/48] Installing png-1.6.37...
[analytics.legios.org] [5/48] Extracting png-1.6.37: 100%
[analytics.legios.org] [6/48] Installing tiff-4.0.10_1...
[analytics.legios.org] [6/48] Extracting tiff-4.0.10_1: 100%
[analytics.legios.org] [7/48] Installing php73-7.3.8...
[analytics.legios.org] [7/48] Extracting php73-7.3.8: 100%
[analytics.legios.org] [8/48] Installing webp-1.0.2...
[analytics.legios.org] [8/48] Extracting webp-1.0.2: 100%
[analytics.legios.org] [9/48] Installing tidy-lib-090315.c_3...
[analytics.legios.org] [9/48] Extracting tidy-lib-090315.c_3: 100%
[analytics.legios.org] [10/48] Installing php73-session-7.3.8...
[analytics.legios.org] [10/48] Extracting php73-session-7.3.8: 100%
[analytics.legios.org] [11/48] Installing libmcrypt-2.5.8_3...
[analytics.legios.org] [11/48] Extracting libmcrypt-2.5.8_3: 100%
[analytics.legios.org] [12/48] Installing libltdl-2.4.6...
[analytics.legios.org] [12/48] Extracting libltdl-2.4.6: 100%
[analytics.legios.org] [13/48] Installing libgd-2.2.5_1,1...
[analytics.legios.org] [13/48] Extracting libgd-2.2.5_1,1: 100%
[analytics.legios.org] [14/48] Installing sqlite3-3.28.0...
[analytics.legios.org] [14/48] Extracting sqlite3-3.28.0: 100%
[analytics.legios.org] [15/48] Installing php73-pdo-7.3.8...
[analytics.legios.org] [15/48] Extracting php73-pdo-7.3.8: 100%
[analytics.legios.org] [16/48] Installing php73-zlib-7.3.8...
[analytics.legios.org] [16/48] Extracting php73-zlib-7.3.8: 100%
[analytics.legios.org] [17/48] Installing oniguruma-6.9.2...
[analytics.legios.org] [17/48] Extracting oniguruma-6.9.2: 100%
[analytics.legios.org] [18/48] Installing libzip-1.5.2...
[analytics.legios.org] [18/48] Extracting libzip-1.5.2: 100%
[analytics.legios.org] [19/48] Installing php73-tidy-7.3.8...
[analytics.legios.org] [19/48] Extracting php73-tidy-7.3.8: 100%
[analytics.legios.org] [20/48] Installing php73-opcache-7.3.8...
[analytics.legios.org] [20/48] Extracting php73-opcache-7.3.8: 100%
[analytics.legios.org] [21/48] Installing php73-xml-7.3.8...
[analytics.legios.org] [21/48] Extracting php73-xml-7.3.8: 100%
[analytics.legios.org] [22/48] Installing php73-simplexml-7.3.8...
[analytics.legios.org] [22/48] Extracting php73-simplexml-7.3.8: 100%
[analytics.legios.org] [23/48] Installing php73-dom-7.3.8...
[analytics.legios.org] [23/48] Extracting php73-dom-7.3.8: 100%
[analytics.legios.org] [24/48] Installing php73-ctype-7.3.8...
[analytics.legios.org] [24/48] Extracting php73-ctype-7.3.8: 100%
[analytics.legios.org] [25/48] Installing php73-posix-7.3.8...
[analytics.legios.org] [25/48] Extracting php73-posix-7.3.8: 100%
[analytics.legios.org] [26/48] Installing php73-fileinfo-7.3.8...
[analytics.legios.org] [26/48] Extracting php73-fileinfo-7.3.8: 100%
[analytics.legios.org] [27/48] Installing php73-openssl-7.3.8...
[analytics.legios.org] [27/48] Extracting php73-openssl-7.3.8: 100%
[analytics.legios.org] [28/48] Installing php73-hash-7.3.8...
[analytics.legios.org] [28/48] Extracting php73-hash-7.3.8: 100%
[analytics.legios.org] [29/48] Installing php73-filter-7.3.8...
[analytics.legios.org] [29/48] Extracting php73-filter-7.3.8: 100%
[analytics.legios.org] [30/48] Installing php73-pecl-mcrypt-1.0.2...
[analytics.legios.org] [30/48] Extracting php73-pecl-mcrypt-1.0.2: 100%
[analytics.legios.org] [31/48] Installing php73-sockets-7.3.8...
[analytics.legios.org] [31/48] Extracting php73-sockets-7.3.8: 100%
[analytics.legios.org] [32/48] Installing php73-soap-7.3.8...
[analytics.legios.org] [32/48] Extracting php73-soap-7.3.8: 100%
[analytics.legios.org] [33/48] Installing php73-bcmath-7.3.8...
[analytics.legios.org] [33/48] Extracting php73-bcmath-7.3.8: 100%
[analytics.legios.org] [34/48] Installing php73-gd-7.3.8...
[analytics.legios.org] [34/48] Extracting php73-gd-7.3.8: 100%
[analytics.legios.org] [35/48] Installing php73-curl-7.3.8...
[analytics.legios.org] [35/48] Extracting php73-curl-7.3.8: 100%
[analytics.legios.org] [36/48] Installing php73-tokenizer-7.3.8...
[analytics.legios.org] [36/48] Extracting php73-tokenizer-7.3.8: 100%
[analytics.legios.org] [37/48] Installing php73-readline-7.3.8...
[analytics.legios.org] [37/48] Extracting php73-readline-7.3.8: 100%
[analytics.legios.org] [38/48] Installing php73-json-7.3.8...
[analytics.legios.org] [38/48] Extracting php73-json-7.3.8: 100%
[analytics.legios.org] [39/48] Installing php73-intl-7.3.8...
[analytics.legios.org] [39/48] Extracting php73-intl-7.3.8: 100%
[analytics.legios.org] [40/48] Installing php73-sqlite3-7.3.8...
[analytics.legios.org] [40/48] Extracting php73-sqlite3-7.3.8: 100%
[analytics.legios.org] [41/48] Installing php73-pdo_mysql-7.3.8...
[analytics.legios.org] [41/48] Extracting php73-pdo_mysql-7.3.8: 100%
[analytics.legios.org] [42/48] Installing php73-mysqli-7.3.8...
[analytics.legios.org] [42/48] Extracting php73-mysqli-7.3.8: 100%
[analytics.legios.org] [43/48] Installing php73-memcache-4.0.4...
[analytics.legios.org] [43/48] Extracting php73-memcache-4.0.4: 100%
[analytics.legios.org] [44/48] Installing php73-mbstring-7.3.8...
[analytics.legios.org] [44/48] Extracting php73-mbstring-7.3.8: 100%
[analytics.legios.org] [45/48] Installing php73-iconv-7.3.8...
[analytics.legios.org] [45/48] Extracting php73-iconv-7.3.8: 100%
[analytics.legios.org] [46/48] Installing php73-zip-7.3.8...
[analytics.legios.org] [46/48] Extracting php73-zip-7.3.8: 100%
[analytics.legios.org] [47/48] Installing php73-bz2-7.3.8...
[analytics.legios.org] [47/48] Extracting php73-bz2-7.3.8: 100%
[analytics.legios.org] [48/48] Installing php73-matomo-3.9.1_1...
[analytics.legios.org] [48/48] Extracting php73-matomo-3.9.1_1: 100%
Message from php73-session-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-18-session.ini
Message from php73-pdo-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-pdo.ini
Message from php73-zlib-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-zlib.ini
Message from php73-tidy-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-tidy.ini
Message from php73-opcache-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-10-opcache.ini
Message from php73-xml-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-xml.ini
Message from php73-simplexml-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-simplexml.ini
Message from php73-dom-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-dom.ini
Message from php73-ctype-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-ctype.ini
Message from php73-posix-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-posix.ini
Message from php73-fileinfo-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-fileinfo.ini
Message from php73-openssl-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-openssl.ini
Message from php73-hash-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-hash.ini
Message from php73-filter-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-filter.ini
Message from php73-pecl-mcrypt-1.0.2:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-mcrypt.ini
Message from php73-sockets-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-sockets.ini
Message from php73-soap-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-soap.ini
Message from php73-bcmath-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-bcmath.ini
Message from php73-gd-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-gd.ini
Message from php73-curl-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-curl.ini
Message from php73-tokenizer-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-tokenizer.ini
Message from php73-readline-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-readline.ini
Message from php73-json-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-json.ini
Message from php73-intl-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-intl.ini
Message from php73-sqlite3-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-sqlite3.ini
Message from php73-pdo_mysql-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-30-pdo_mysql.ini
Message from php73-mysqli-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-mysqli.ini
Message from php73-memcache-4.0.4:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-30-memcache.ini
Message from php73-mbstring-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-mbstring.ini
Message from php73-iconv-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-iconv.ini
Message from php73-zip-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-zip.ini
Message from php73-bz2-7.3.8:

This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-bz2.ini
Message from php73-matomo-3.9.1_1:

POST-INSTALL CONFIGURATION FOR Matomo
=======================================
1) Create a user and a empty database for Matomo to store all
   its tables in (or choose an existing database).

2) Add the following to your Apache configuration, and
   restart the server:

   ### Add the AcceptPathInfo directive only for Apache 2.4.30 or later.
   Alias /matomo /usr/local/www/matomo/
   AcceptPathInfo On
   <Directory /usr/local/www/matomo>
      AllowOverride None
      Options Indexes FollowSymLinks
      # Apache 2.4 no longer accepts "Order" or "Allow from ..."
      Require all granted
   </Directory>

3) Visit your Matomo site with a browser (i.e.,
   http://your.server.com/matomo/), and you should
   be taken to the setup script, which will lead
   you through setting up Matomo.

For more information, see the INSTALL DOCUMENTATION:

  https://matomo.org/docs/installation/

========================================

But wait - mariadb server isn't being installed, only mariadb client! This isn't a problem. As shown above, mariab104-client is installed, to resolve this we just type pkg install mariadb104-server

This will show:

Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating 1.pkg.legios.org repository catalogue...
1.pkg.legios.org repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        mariadb104-server: 10.4.6_1 [1.pkg.legios.org]
        unixODBC: 2.3.7 [1.pkg.legios.org]

Number of packages to be installed: 2

The process will require 214 MiB more space.
32 MiB to be downloaded.

Proceed with this action? [y/N]: y
[analytics.legios.org] [1/2] Fetching mariadb104-server-10.4.6_1.txz: 100%   31 MiB  32.8MB/s    00:01
[analytics.legios.org] [2/2] Fetching unixODBC-2.3.7.txz: 100%  463 KiB 474.3kB/s    00:01
Checking integrity... done (0 conflicting)
[analytics.legios.org] [1/2] Installing unixODBC-2.3.7...
[analytics.legios.org] [1/2] Extracting unixODBC-2.3.7: 100%
[analytics.legios.org] [2/2] Installing mariadb104-server-10.4.6_1...
===> Creating groups.
Creating group 'mysql' with gid '88'.
===> Creating users
Creating user 'mysql' with uid '88'.

Enabling nginx and mariadb/mysql

There's two ways to do this. One is to use sysrc. To use this method, type the following as root

# sysrc nginx_enable=YES && sysrc mysql_enable=YES

OR

# edit /etc/rc.conf

then enter nginx_enable=“YES” and mysql_enable=“YES” in to your rc.conf

Once this is done, you can start your mysql server via service mysql-server start

One first start, it should show this information:

Installing MariaDB/MySQL system tables in '/var/db/mysql' ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is root@localhost, it has no password either, but
you need to be the system 'root' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/usr/local' ; /usr/local/bin/mysqld_safe --datadir='/var/db/mysql'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

Starting mysql.

Once this is done, execute mysql_secure_installation. This will present you with a series of options, please read them all carefully and follow it!

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n]
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Cool, now that that's done, we can move on to creating a user for Matomo!

(TBC)

1)
Please note that I do not use sudo inside jails, instead I execute the shell from the parent (or 'warden') by typing jexec $jailname, in this case jexec analytics
2)
please note that I have an internal Poudriere server hence why 1.pkg.legios.org is showing up too. As you can see I'm not building all the packages required for Matomo
3)
If you wish to do it more hands-off, you can type pkg install -y nginx php73-matomo which always assumes yes when asked for confirmation before package installation. - however you should sometimes be careful as it may wish to delete or update things you don't want to update
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International