Introduction
MediaWiki is a free and open-source application that allows anyone to create a wiki website on a self-hosted server. it is widely used to create collaborative websites. It is written in PHP and uses a database to store its content.
In this article, we will discuss how to install MediaWiki on Fedora 34.
Prerequisites
- A Fedora 34 machine with root access.
- A LAMP stack is installed (Apache, PHP, and MySQL/MariaDB).
Install LAMP Server
-
The first step is to install the Apache web server, which will be used to host MediaWiki. To install Apache, open a terminal and run the following command.
# sudo dnf -y install httpd
-
Once the installation is complete, start the Apache service and enable it to start automatically on boot by running the following commands.
# sudo systemctl start httpd
# sudo systemctl enable httpd -
Install the MariaDB database server.
# sudo dnf -y install mariadb-server
-
Start the MariaDB service and enable it to start automatically on boot.
# sudo systemctl start mariadb
# sudo systemctl enable mariadb -
Next, we need to secure the MariaDB installation by running the following command.
The command will ask you a series of questions. You can press Enter to accept the default values for most questions, but make sure you set a secure password for the MariaDB root user.# sudo mysql_secure_installation
-
MediaWiki is written in PHP, so we need to install it on our server. To install PHP, run the following command.
# sudo dnf -y install php php-gd php-json php-mysqlnd php-xml php-mbstring php-intl
Create a MySQL database
-
Next, you need to create a MySQL database for MediaWiki to use. To create a database, run the following commands
# sudo mysql -u root
-
create a new database for MediaWiki.
CREATE DATABASE mediawiki;
CREATE 'wikiuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON mediawiki.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
Download MediaWiki
-
Next, we need to download the latest version of MediaWiki from the official website. You can download it using the following command.
# sudo dnf -y install wget
# sudo wget https://releases.wikimedia.org/mediawiki/1.36/mediawiki-1.36.2.tar.gz -
Then, extract the downloaded file and move it to the Apache web directory.
# tar -zxvf mediawiki-1.36.2.tar.gz
# sudo mv mediawiki-1.36.2 /var/www/html/mediawiki -
Change ownership and permissions of the MediaWiki directory.
# sudo chown -R apache:apache /var/www/html/mediawiki/
# sudo chmod -R 755 /var/www/html/mediawiki/
Configure Apache for MediaWiki
-
Now that you have installed MediaWiki, you need to configure it. First, create a configuration file.
# sudo vi /etc/httpd/conf.d/mediawiki.conf
-
Add the following lines to the file.
Replace '207.199.149.44' with your domain name or server IP address.<VirtualHost *:80>
ServerName 207.199.149.141
DocumentRoot /var/www/html/mediawiki
<Directory "/var/www/html/mediawiki/">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/mediawiki_error.log
CustomLog /var/log/httpd/mediawiki_access.log combined
</VirtualHost> -
Disable SELinux.
# sudo setenforce 0
-
Restart the Apache web server.
# sudo systemctl restart httpd
- Open your web browser and access the MediaWiki installation page using http://your_ip_address.
Click on the "complete_the_installation" link and follow the on-screen instructions to complete the installation, providing the required database and admin user information.