Manual:Running MediaWiki on FreeBSD

This installation guide assumes you are installing on the local machine (localhost) and that you are logged in as the superuser (root).

Set up the requirements

edit

Instructions tested on FreeBSD 14.0 with the newest[2023-12-24] packages for mediawiki139 (LTS).

Database

edit

Install the typical database server(At the time of writing mysql80 is the default version) for MediaWiki

pkg install mysql80-server

Enable MySQL at startup

service mysql-server enable

Start MySQL as the database server

service mysql-server start

Secure the MySQL installation

/usr/local/bin/mysql_secure_installation

Apache

edit

Install the typical web server Apache (2.4)

pkg install apache24

Apache (2.4) at startup

service apache24 enable

Edit the config file of the web server Apache (2.4) to find MediaWiki

$EDITOR /usr/local/etc/apache24/httpd.conf
#DocumentRoot "/usr/local/www/apache24/data"
DocumentRoot "/usr/local/www/mediawiki"
<Directory "/usr/local/www/mediawiki">
	Options Indexes FollowSymLinks
	DirectoryIndex index.php
	AllowOverride None
	Require all granted
</Directory>

Install the module for the web server Apache (2.4) to handle PHP(At the time of writing php82 is the default)

pkg install mod_php82

By installing this package there will be a line added to the config file of the web server Apache (2.4).

Check the entry for the module php_module
grep php /usr/local/etc/apache24/httpd.conf
LoadModule php_module	libexec/apache24/libphp.so

Edit the config file of the web server Apache (2.4) to handle PHP

$EDITOR /usr/local/etc/apache24/httpd.conf
<IfModule php_module>
	DirectoryIndex index.php index.html
 	AddType application/x-httpd-php .php
	AddType application/x-httpd-php-source .phps
</IfModule>

Please check that you set up your hostname at the config file of system environment (for booting next time).

grep hostname /etc/rc.conf
hostname="wiki.your-domain.tld"
If it is not set you might add it to the config file of system environment (for booting next time).
sysrc hostname="wiki.your-domain.tld"

Install MediaWiki

edit

See Manual:Installing MediaWiki


  Warning: MediaWiki FreeBSD packages are not maintained by the MediaWiki community. Use them at your own risk, they may be broken

Otherwise you can install MediaWiki with the packages provided by FreeBSD directly.

There are several versions of MediaWiki available at FreeBSD. Which are available at present, you can check via pkg.

pkg search mediawiki

Instructions tested on FreeBSD 14.0 with php82

pkg install mediawiki139-php82

Install additional packages for full support of default MediaWiki

edit

Install the version control system git

pkg install git-lite

Install additional package to handle displaying pictures for PHP

pkg install php82-pecl-imagick

Install additional package to can caching for PHP

pkg install php82-pecl-APCu

Replace php82- by the PHP version you want, for example php81- or php83-.

SVG support

edit

Add the following lines to LocalSettings.php to allow SVG upload and to enable thumbnail and preview rendering with Inkscape:

$wgFileExtensions = [ 'png', 'gif', 'jpg', 'jpeg', 'svg' ];
$wgSVGConverters = [
  'Inkscape' => '/usr/local/bin/inkscape -z -w $width -f $input -e $output',
];
$wgSVGConverter = 'Inkscape';

Obviously, Inkscape must be installed for this to work (pkg_add -r inkscape). Wikipedia is still using rsvg for SVG rendering, which produces less accurate results than Inkscape but is faster.[1]

See also

edit

References

edit