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

Install Apache, PHP, MySQL, and MediaWiki
These can either be installed from binaries (using pkg_add) or from source via the ports tree under /usr/ports.

To install from binaries (faster option):

pkg_add -r apache22 mysql-server php5 php5-mysql mediawiki php5-xmlreader php5-ctype tidy

NOTE: If you are using FreeBSD 8.2, replace the mysql-server with mysql50-server or mysql51-server (the latter matching mysql51-client that may already have been installed on 8.2 by other packages).

Unfortunately, the binary installation of php5 does not include mod_php</tt>, which is needed by Apache to execute PHP code in pages. Therefore (taken from the FreeBSD handbook, section 29.7.6.4):

cd /usr/ports/lang/php5 make config make make deinstall make reinstall

During the make config</tt> step above, enable the "APACHE" option in the menu.

Set up MySQL
The easiest method is to only set a root password and then let the MediaWiki installer script do the rest:

mysqladmin -u root password password history -c

Use

/usr/local/etc/rc.d/mysql-server onestart

to start MySQL. (Later we will edit rc.conf so MySQL gets started automatically during boot.)

Edit /usr/local/etc/apache22/httpd.conf
Make sure the following sections have been added to /usr/local/etc/apache22/httpd.conf:

LoadModule php5_module       libexec/apache/libphp5.so

<IfModule php5_module> DirectoryIndex index.php index.html AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </IfModule>

If you want to serve MediaWiki content exclusively, you can simply change the Apache document root to the MediaWiki installation directory:

DocumentRoot "/usr/local/www/mediawiki"

Also add an entry for the MediaWiki directory to httpd.conf</tt>:

<Directory "/usr/local/www/mediawiki"> Options Indexes FollowSymLinks DirectoryIndex index.php index.html AllowOverride None Order allow,deny Allow from all </Directory>

Use

apachectl restart

to launch (or relaunch) Apache. Open http://localhost in your browser to see if Apache works.

Edit /etc/rc.conf
Make sure your hostname</tt> in rc.conf</tt> contains a domain name, and that Apache and MySQL are set to start automatically during boot:

hostname="mycomputer.example.com" apache22_enable="YES" mysql_enable="YES"

MediaWiki extensions
Extensions are installed by extracting the ".tar.gz" archive to /usr/local/www/mediawiki/extensions/</tt>, registering the extension in LocalSettings.php</tt>, and restarting Apache.

SVG support
Add the following lines to LocalSettings.php</tt> to allow SVG upload and to enable thumbnail and preview rendering with Inkscape:

$wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg', 'svg'); $wgSVGConverters = array(   '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</tt>). Wikipedia is still using rsvg for SVG rendering, which produces less accurate results than Inkscape but is faster.