Media Wiki is a free and open-source PHP based application developed originally by the Wikimedia Foundation for the use on Wikipedia. It is now also used by several projects of the non-profit Wikimedia Foundation and by many other wikis, including its own website, MediaWiki. Media Wiki has more than 800 and 2,000 configuration settings and extensions available respectively to enable various features that can be changed and added. It is designed and developed specifically to efficiently handle large projects and websites, which can have many terabytes of content and high traffic of hundreds of thousands of hits per second. It is licensed under GNU General Public License (GPL) version 2 and other later versions whereas its documentation is released under Creative Common BY-SA 3.0 License and partly under the public domain. Some of the key features of Media Wiki are as follows.
- Media Wiki is internationalized and localized by its awesome volunteers.
- It is very easy to install and configure in a hosting server.
- Extensible lightweight wiki markup is used for content displaying mechanism as it is easy to use and learn than HTML.
- It consists of a featured text editing interface with a toolbox with minor edits like correction of spellings, grammar, and punctuation.
- It consists of an extensible Web API (Application Programming Interface) that provides a direct and high-level access to the Database of Wiki Media.
- It has the ability to deal with dealing with wide varieties of uploaded media files especially image files.
- Tracking and navigating recent changes made to the content is one of the key features of Media Wiki
- Content management and organization is easy with an interactive web interface and are organized with page tabs and associated pages, namespaces, categories tags, subpages.
- As its an open-source web application, it is highly customizable and can be modified easily according to the need.
- Media Wiki consists of groups and restrictions of access making it easy to maintain.
- It is highly extensible as we can add our custom-built PHP codes using its call back functions.
Here are some easy steps on how we can deploy Media Wiki with MariaDB as a database management system on Fedora 22 operating system.
1. Installing LAMP Stack
First of all, we’ll gonna install LAMP Stack in our Fedora 22 installed box. LAMP stack is the combination of Apache Web Server, MariaDB Database Server, and PHP. As the whole lamp stack is available on the official repository of fedora 22, we’ll gonna install it using our new package manage ie dnf package manager. To install it, we’ll need to open a new terminal and run the following command in it.
# dnf install -y httpd mariadb-server mariadb php php-pear php-xml php-mysql php-intl php-pecl-apc php-gd php-mbstring ImageMagick-perl wget nano texlive php-xcache
2. Starting Apache and MariaDB server
Next, we’ll gonna start our newly installed apache webserver and MariaDB database server. As we’re running fedora 22 in our box, systemd is installed by default so, we’ll need to start the service using systemctl command as shown below.
# systemctl start httpd mariadb
3. Configuring MariaDB for Media Wiki
Now, as we haven’t assigned a root password for MariaDB so we’ll first need to configure a root password for it. Then, we’ll gonna create a new database so that it can store data for Media Wiki.
To configure MariaDB and assign a root password, we’ll need to run the following command.
This will ask us to enter the password for root but as we haven’t set any password before and its our first time we’ve installed MariaDB, we’ll simply press enter and go further. Then, we’ll be asked to set root password, here we’ll hit Y and enter our password for root of MariaDB. Then, we’ll simply hit enter to set the default values for the further configurations.
.... so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! ... installation should now be secure. Thanks for using MariaDB!
Next, we’ll log in to the MariaDB command prompt as root.
# mysql -u root -p
Here, we’ll need to enter the password of the MariaDB root account that we had set above.
After we’re logged in into the mariadb command prompt, we’ll gonna create the database for media wiki.
> CREATE DATABASE mediawiki_db; > CREATE USER 'mediawiki_user'@'localhost' IDENTIFIED BY 'mediawiki_Pa$worD'; > GRANT ALL PRIVILEGES ON mediawiki_db.* TO 'mediawiki_user'@'localhost'; > FLUSH PRIVILEGES; > EXIT;
Finally, we’ve successfully created a database named mediawiki_db with username mediawiki_user and password as mediawiki_Pa$$worD .
Note: It is strongly recommended to replace the above variables as your desire for the security issue.
4. Downloading the latest MediaWiki
We will now download the latest release of MediaWiki from the official media wiki download server ie https://www.mediawiki.org/wiki/Download . As the current latest stable release of MediaWiki is version 1.25.1, we’ll gonna get the link of the tarball that we wanna install from the download page. Then we’ll gonna download it using wget in terminal or console.
# cd /tmp/ # wget https://releases.wikimedia.org/mediawiki/1.25/mediawiki-1.25.1.tar.gz
–2015-07-30 18:03:22– https://releases.wikimedia.org/mediawiki/1.25/mediawiki-1.25.1.tar.gz
Resolving releases.wikimedia.org (releases.wikimedia.org)… 188.8.131.52, 2620:0:861:ed1a::11
Connecting to releases.wikimedia.org (releases.wikimedia.org)|184.108.40.206|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 23661450 (23M) [application/x-gzip]
Saving to: ‘mediawiki-1.25.1.tar.gz’
mediawiki-1.25.1.tar.gz 100%[==========================================>] 22.56M 4.34MB/s in 5.9s
2015-07-30 18:03:29 (3.81 MB/s) – ‘mediawiki-1.25.1.tar.gz’ saved [23661450/23661450]
5. Extracting Media Wiki
Next, we’ll gonna extract the tarball of MediaWiki that we had just downloaded above using tar command.
# tar -xzvf mediawiki-1.25.1.tar.gz
Then, we’ll move the extracted files to our webroot. As we’ve installed Apache web server in our fedora 22 box, we’ll need to move the files under /var/www/html/ directory as its the default webroot of Apache web server.
# mv mediawiki-1.25.1 /var/www/html/mediawiki
6. Configuring Ownership
Now, after we have successfully moved the required files of mediawiki to the webroot directory, we’ll now need to assign ownership of the entire files and directories under /var/www/html/mediawiki to apache so that apache process can access the files and make changes if required.
Official Ubuntu Book
The free Ubuntu operating system has won the hearts and minds of millions of users worldwide. It combines a strong technical platform, impressive quality, and an enthusiastic global community of users who relentlessly support, document, and test it.
# chown -R apache:apache /var/www/html/mediawiki
7. Configuring SELinux
We’ll now need to configure SELinux as we’re on Fedora 22. It is enabled in fedora 22 by default so we’ll need to make SELinux allow our mediawiki installation. To do so, we’ll need to run the following command.
# restorecon -FR /var/www/html/mediawiki/
8. Restarting Apache and MariaDB
Next, we’ll gonna restart our Apache and MariaDB server using systemctl.
# systemctl restart httpd mariadb
9. Web Installation
Finally, after everything above is done, we’ll now gonna navigate to our MediaWiki installation using our favorite web browser. To navigate, we’ll need to point our browser to http://ip-address/mediawiki/ or http://domain.com/mediawiki according to the configuration we’ve made. After browsing to the url of the mediawiki installation, we’ll see the following screen.
Now, we’ll gonna click on “set up the wiki” to continue the installation.
Then, we’ll be asked to choose the language we wanna apply to MediaWiki. After we select the language, we’ll click on Continue button. After that, we’ll be welcomed by the MediaWiki Installer then we’ll click Continue to go further.
Next, here comes the most important part, we’ll now need to enter the database name, user and password. Here, we’ll need to enter the required variables that we had set in the above step 2. After done, we’ll need to click on Continue button.
Then, a Database setting page will appear. Here, we’ll simply click Continue in order to go further with the default values.
Now, we’ll be asked to enter the information of our Wiki installation and username and password that we wanna keep in order to access Wiki. After done, we’ll see a page which states that it has installed MediaWiki successfully. Then, we’ll click Continue and move further.
10. Post Installation
In the above web installation, we’ll be asked to download LocalSettings.php file. We’ll simply need to download that file using our web browser and open it using a text editor.
Then, we’ll simply copy the PHP codes of the file and paste it to the file /var/www/html/mediawiki/LocalSettings.php which is located in our Fedora 22 server.
# nano /var/www/html/mediawiki/LocalSettings.php
Then we’ll save and exit the text editor.
Finally, we’ll be now able to see our Media Wiki Page by navigating to our wiki installation url as shown below.
We’ve now learned how we can successfully deploy MediaWiki and run our own Wiki site in our Fedora 22 machine. There are plenty of wiki software like DokuWiki, PmWiki, Wikia, WikkaWiki and more that we can find from the web and deploy per our needs and requirements.
This tutorial can be applied for installing MediaWiki in other platforms also like Ubuntu, CentOS, RHEL besides Fedora 22 with few changes in the commands. MediaWiki is an awesome efficient and the best wiki product which is developed and maintained by Wikimedia Foundation.
If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy 🙂
Arun Pyasi is a Linux and Open Source Enthusiast who has years of Experience in Linux, Systems, DevOps, Cloud servers and Web Development.