Before we can install Mediawiki on OpenBSD, we need to make sure that some required packages are installed on our system. These packages are:
To install these packages, run the following command in the terminal:
$ sudo pkg_add apache php mysql-client mysql-server
Next, we need to download the Mediawiki source code from the official website. You can either download the latest stable release or the latest development version. For this tutorial, we will download the latest stable release.
To download and extract Mediawiki, run the following commands in the terminal:
$ cd /var/www/htdocs
$ sudo ftp https://releases.wikimedia.org/mediawiki/1.36/mediawiki-1.36.0.tar.gz
$ sudo tar -xvzf mediawiki-1.36.0.tar.gz
$ sudo mv mediawiki-1.36.0 mediawiki
Before we can install Mediawiki, we need to create a MySQL database for it to use. To create a new database, run the following commands in the terminal:
$ sudo mysql_install_db
$ sudo /usr/local/bin/mysqld_safe &
$ mysql -u root -p
Enter your MySQL root password when prompted. Then, create a new database and a new user for Mediawiki:
mysql> CREATE DATABASE mediawiki;
mysql> CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'wikipassword';
mysql> GRANT ALL PRIVILEGES ON mediawiki.* TO 'wikiuser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> EXIT;
Next, we need to configure Apache to serve our Mediawiki installation. Open the Apache configuration file in your favorite text editor:
$ sudo vi /etc/apache/httpd.conf
Add the following lines at the bottom of the file:
Alias /mediawiki /var/www/htdocs/mediawiki
<Directory /var/www/htdocs/mediawiki>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
require all granted
</Directory>
Save and exit the file. Then, restart the Apache server:
$ sudo /etc/rc.d/apache2 restart
Finally, we can install Mediawiki by navigating to the following URL in our web browser:
http://localhost/mediawiki/config/index.php
Follow the on-screen instructions to set up Mediawiki. When asked for the database information, enter the following details:
Once the installation is complete, you should be able to access your new Mediawiki installation by navigating to the following URL in your web browser:
http://localhost/mediawiki/index.php
Congratulations! You have successfully installed Mediawiki on OpenBSD.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!