How to Install Mediawiki on Elementary OS Latest
In this tutorial, we will walk through the process of installing Mediawiki on Elementary OS, a user-friendly Linux operating system. Mediawiki is a powerful and popular software platform that enables users to create and manage collaborative wikis, and it can be installed and configured easily on any Linux distribution, including Elementary OS.
Prerequisites
Before we begin, you will need the following:
- A working installation of Elemental OS, with administrative privileges
- A web server installed on your machine, such as Apache or Nginx
- A database management system installed on your machine, such as MySQL or MariaDB
Step 1: Download and Extract Mediawiki
The first step to install Mediawiki is to download and extract it onto your machine. Here are the steps to follow:
Visit the official Mediawiki website at
https://www.mediawiki.org/wiki/MediaWikiand download the latest stable version of Mediawiki.Once the download is complete, extract the contents of the compressed file to a suitable location on your machine. You can use your preferred archive tool to extract the file, or you can use the command line utility
tarto extract the file as follows:
$ tar -xvzf mediawiki-1.35.0.tar.gz
Note that you should replace mediawiki-1.35.0.tar.gz with the actual name of the downloaded file.
Step 2: Create a Database for Mediawiki
Mediawiki requires a database to store its content and configuration information. Here are the steps to create a new database for Mediawiki:
Launch your database management system and log in with administrative privileges.
Create a new database for Mediawiki by running the following command:
CREATE DATABASE mediawiki_db;
Note that you can replace mediawiki_db with any name that you prefer.
- Create a new database user and grant it privileges to access the newly created database by running the following commands:
CREATE USER 'wikiuser'@'localhost';
GRANT ALL ON mediawiki_db.* TO 'wikiuser'@'localhost';
Note that you should replace wikiuser with any username that you prefer.
Step 3: Configure Apache or Nginx
Mediawiki requires a web server to serve its pages to end-users. You can use Apache or Nginx as your web server. Here are the steps to configure Apache or Nginx for Mediawiki:
Apache Config
- Install the Apache web server on your machine by running the following command:
$ sudo apt-get install apache2
- Create a new virtual host configuration file for Mediawiki in the
/etc/apache2/sites-available/directory by running the following command:
$ sudo nano /etc/apache2/sites-available/mediawiki.conf
- Add the following lines to the file:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/mediawiki
ServerName wiki.example.com
ServerAlias www.wiki.example.com
<Directory /var/www/html/mediawiki/>
Options FollowSymLinks
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Note that you should replace [email protected], wiki.example.com, and www.wiki.example.com with your actual email and domain names.
- Enable the virtual host configuration file by running the following command:
$ sudo a2ensite mediawiki
- Restart the Apache web server by running the following command:
$ sudo systemctl restart apache2
Nginx Config
- Install the Nginx web server on your machine by running the following command:
$ sudo apt-get install nginx
- Create a new virtual host configuration file for Mediawiki in the
/etc/nginx/sites-available/directory by running the following command:
$ sudo nano /etc/nginx/sites-available/mediawiki.conf
- Add the following lines to the file:
server {
listen 80;
server_name wiki.example.com www.wiki.example.com;
root /var/www/html/mediawiki;
index index.php index.html index.htm;
access_log /var/log/nginx/wiki.example.com.access.log;
error_log /var/log/nginx/wiki.example.com.error.log;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location /images {
try_files $uri /mediawiki/index.php;
}
}
Note that you should replace wiki.example.com and www.wiki.example.com with your actual domain names.
- Create a symbolic link to the
mediawiki.conffile in the/etc/nginx/sites-enabled/directory by running the following command:
$ sudo ln -s /etc/nginx/sites-available/mediawiki.conf /etc/nginx/sites-enabled/
- Restart the Nginx web server by running the following command:
$ sudo systemctl restart nginx
Step 4: Install Mediawiki
Now that your machine is configured, you can install Mediawiki by following these steps:
Open your web browser and navigate to your wiki domain name, for example,
http://wiki.example.com.You will see the Mediawiki installation page. Follow the installation steps, including setting up the database connection, creating a new administrator account, and configuring the basic settings.
Once the installation is complete, you can log in to your new Mediawiki site and start using it.
Conclusion
In this tutorial, we have seen the steps required to install Mediawiki on Elementary OS. By following these steps, you can set up your own self-hosted wiki platform and use it to manage your collaborative content.