How to Install Mediawiki on OpenBSD
Step 1: Install Required Packages
Before we can install Mediawiki on OpenBSD, we need to make sure that some required packages are installed on our system. These packages are:
- apache
- php
- mysql-client
- mysql-server
To install these packages, run the following command in the terminal:
$ sudo pkg_add apache php mysql-client mysql-server
Step 2: Download and Extract Mediawiki
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
Step 3: Create a MySQL Database
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;
Step 4: Configure Apache
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
Step 5: Install Mediawiki
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:
- Database host: localhost
- Database name: mediawiki
- Database username: wikiuser
- Database password: wikipassword
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.