How To Install MediaWiki on Fedora 41
Setting up a collaborative platform like MediaWiki on Fedora 41 empowers individuals and organizations to manage and share knowledge efficiently. Whether you’re aiming to create a personal wiki, a community-driven knowledge base, or a documentation hub for your projects, MediaWiki offers a robust solution. This comprehensive guide walks you through the step-by-step process of installing MediaWiki on Fedora 41, ensuring a smooth and secure setup.
Pre-Installation Setup
System Preparation
Before diving into the installation of MediaWiki, it’s essential to prepare your Fedora 41 system to meet the necessary requirements. Begin by updating your system to ensure all packages are current:
sudo dnf update -y
Next, configure the firewall to allow HTTP and HTTPS traffic, which are crucial for accessing your MediaWiki instance:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Ensure your system meets the minimum hardware requirements, typically at least 2GB of RAM and sufficient storage based on your anticipated content volume.
Installation Methods Overview
There are two primary methods to install MediaWiki on Fedora 41: using the DNF package manager or performing a manual installation from the source. The package manager offers a streamlined approach with automated dependency handling, whereas manual installation provides greater flexibility and control over configurations.
Method 1: DNF Package Installation
Installing Dependencies
Start by installing the necessary dependencies using DNF. These include the Apache web server, MariaDB for database management, and PHP along with its extensions:
sudo dnf install httpd mariadb-server php php-mysqlnd php-xml php-mbstring -y
After installation, enable and start the MariaDB and Apache services:
sudo systemctl enable mariadb
sudo systemctl start mariadb
sudo systemctl enable httpd
sudo systemctl start httpd
Configuration Steps
With dependencies in place, install MediaWiki using the DNF package manager:
sudo dnf install mediawiki -y
Once installed, locate the configuration files typically found in /etc/mediawiki/
. Adjust configurations as needed to suit your environment, such as setting up the database connection parameters.
Method 2: Manual Installation
Installing Prerequisites
If opting for a manual installation, begin by setting up the Apache web server:
sudo dnf install httpd -y
sudo systemctl enable httpd
sudo systemctl start httpd
Next, install and configure MariaDB:
sudo dnf install mariadb-server -y
sudo systemctl enable mariadb
sudo systemctl start mariadb
sudo mysql_secure_installation
Proceed to install PHP and the required extensions:
sudo dnf install php php-mysqlnd php-xml php-mbstring -y
MediaWiki Setup
Download the latest version of MediaWiki from the official website:
wget https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.0.tar.gz
Extract the downloaded tarball and move it to the web server’s root directory:
tar -xvzf mediawiki-1.43.0.tar.gz
sudo mv mediawiki-1.43.0 /var/www/html/mediawiki
Set the appropriate permissions to ensure the web server can access the files:
sudo chown -R apache:apache /var/www/html/mediawiki
sudo chmod -R 755 /var/www/html/mediawiki
Database Configuration
Creating a dedicated database and user for MediaWiki enhances security and organization. Access the MariaDB prompt:
sudo mysql -u root -p
Within the prompt, execute the following commands to create the database and user:
CREATE DATABASE mediawiki;
GRANT ALL PRIVILEGES ON mediawiki.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'securepassword';
FLUSH PRIVILEGES;
EXIT;
Replace 'securepassword'
with a strong password to safeguard your database.
Web Server Configuration
Apache Setup
Configure Apache to serve your MediaWiki site by creating a new virtual host file:
sudo nano /etc/httpd/conf.d/mediawiki.conf
Add the following configuration, adjusting paths and domain names as necessary:
<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /var/www/html/mediawiki
ServerName yourdomain.com
<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>
Save the file and restart Apache to apply the changes:
sudo systemctl restart httpd
If SELinux is enabled, adjust the policies to allow Apache to serve MediaWiki:
sudo chcon -R -t httpd_sys_rw_content_t /var/www/html/mediawiki
sudo setsebool -P httpd_can_network_connect_db on
MediaWiki Configuration
Access your MediaWiki installation by navigating to http://yourdomain.com/mediawiki
in your web browser. The web-based installer will guide you through the setup process:
- Enter the database details you configured earlier.
- Set up the
LocalSettings.php
file as prompted. - Create the initial admin account to manage your wiki.
Once completed, verify that your MediaWiki site is operational by logging in with your admin credentials.
Security Considerations
Securing your MediaWiki installation is paramount to protect your data and maintain integrity.
- File Permissions: Ensure that sensitive files like
LocalSettings.php
have restricted permissions:sudo chmod 640 /var/www/html/mediawiki/LocalSettings.php
- Database Security: Use strong, unique passwords for database users and consider implementing SSL connections for database interactions.
- Update Management: Regularly update MediaWiki and its extensions to patch vulnerabilities and enhance functionality.
- Backup Procedures: Implement automated backups for both your database and MediaWiki files to prevent data loss.
Troubleshooting Common Issues
Encountering issues during installation is common. Here are solutions to some frequent problems:
- Blank Page Issues: This often results from PHP errors. Check the Apache error logs for detailed messages:
sudo tail -f /var/log/httpd/mediawiki-error.log
- Permission Problems: Ensure that the web server user has the necessary read and write permissions for MediaWiki files.
- Database Connection Errors: Verify that the database credentials in
LocalSettings.php
are correct and that MariaDB is running.
Maintenance and Updates
Maintaining your MediaWiki installation involves regular updates and optimizations:
- Regular Updates: Keep MediaWiki and its extensions up to date by following the official upgrade procedures.
- Backup Strategies: Schedule periodic backups of your database and MediaWiki files using tools like
mysqldump
andrsync
. - Performance Optimization: Utilize caching mechanisms and optimize database queries to enhance the performance of your wiki.
Congratulations! You have successfully installed MediaWiki. Thanks for using this tutorial for installing the MediaWiki on your Fedora 41 system. For additional help or useful information, we recommend you check the official MediaWiki website.