Installing Mediawiki on NetBSD

This tutorial will guide you through the installation of Mediawiki on a NetBSD server. Mediawiki is the software that powers Wikipedia and other wiki-based sites, and it is open-source software that can be installed on your own server to create your own wiki-based site.

Prerequisites

Before we start, you need to have the following:

Step 1: Download Mediawiki

The first step is to download the latest version of Mediawiki from the official website https://www.mediawiki.org/wiki/MediaWiki. You can download the tarball by clicking on the "Download" button on the homepage or by following this link https://releases.wikimedia.org/mediawiki/1.35/mediawiki-1.35.2.tar.gz.

$ cd /usr/local/
$ wget https://releases.wikimedia.org/mediawiki/1.35/mediawiki-1.35.2.tar.gz

Step 2: Extract the Mediawiki files

Once the download is complete, extract the tarball to your web directory. In this example, we'll extract it to the htdocs/ directory.

$ tar zxvf mediawiki-1.35.2.tar.gz -C /usr/local/apache2/htdocs/
$ mv /usr/local/apache2/htdocs/mediawiki-1.35.2/ /usr/local/apache2/htdocs/mediawiki

Step 3: Create a Mediawiki database

To create a new MySQL/MariaDB database called mediawiki, log in to the MySQL shell as root.

$ mysql -u root -p

Then enter your MySQL root password and create a new database:

mysql> create database mediawiki;
mysql> exit;

Step 4: Create a MySQL/MariaDB user for Mediawiki

Create a new MySQL/MariaDB user account to be used with Mediawiki:

mysql> CREATE USER 'mediawiki'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON mediawiki.* TO 'mediawiki'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit;

Replace password with a strong password of your choice.

Step 5: Configure Apache

Create a virtual host for your Mediawiki site in Apache:

$ cd /usr/local/apache2/conf/
$ vi httpd.conf

Add the following lines to the Apache configuration file:

Alias /mediawiki /usr/local/apache2/htdocs/mediawiki
<Directory /usr/local/apache2/htdocs/mediawiki>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

Note: Make sure that the AllowOverride directive is set to All so that the .htaccess file can be used.

Restart Apache server:

$ /etc/rc.d/apache2 restart

Step 6: Set the permissions for Mediawiki

Change the ownership and permissions of the mediawiki directory:

$ chown -R www /usr/local/apache2/htdocs/mediawiki
$ chmod -R 755 /usr/local/apache2/htdocs/mediawiki

Step 7: Install Mediawiki

Open your web browser and go to http://your-ip-address/mediawiki. You will see the Mediawiki installation page.

Follow the installation wizard and enter the database information you created in Step 3 and the MySQL/MariaDB user information you created in Step 4.

Once the installation is completed, log in to your Mediawiki site using the administrator username and password you created during the installation.

Congratulations, you have successfully installed Mediawiki on NetBSD!

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!