Apr 19, 2014

MediaWiki 1.22.6 on Fedora 20

Motivation

As many of you probably know, the next version of Fedora is under many changes F21 is not going to be released earlier than in late October
yum in FC20 only allows to install the version 1.21.8 so in order to have the most recent version we need to Install it as an rpm package or Manually
It is very likely to have problems during the installation, the main problem that I had was related with SELinux, so I hope this post can help you to save some time and headaches ;-)

Prerequisites

I recommend to have a Linux Manual just in case

Install these packages

Open a Terminal and become root
su
yum install -y httpd mysql-server php php-pear php-xml php-mysql php-intl php-php-pecl-zendopcache-apc php-gd php-mbstring ImageMagick-perl mailcap

Configure Services

service mysqld start (service mariadb start)
mysql_secure_installation
*be aware of the database version, mysql was replaced by mariadb
As a good practice you should disable anonymous access and don't allow root access remotely to your database

service httpd start
To make sure that the servers automatically start at boot-up, type the following commands:
chkconfig mysqld on (chkconfig mariadb on)
chkconfig httpd on

-Installing Manually

Drop the tarball or a clone
git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git
in a directory accessible to your web server
/var/www/html/wiki/

-Installing it as an rpm package

Download mediawiki-1.22.6-1.fc21.noarch.rpm from rpmfind.net
*select apropiate architecture
yum localinstall /root/Downloads/mediawiki-1.22.6-1.fc21.noarch.rpm
MediaWiki is installed in
/usr/share/mediawiki
with files specific to a site installed in
/var/www/wiki which contains:
config/
config/index.php
images/
index.php
Files in /var/www/wiki are used as a template and Apache can only access /var/www/html if not modified. So run
cp -a /var/www/wiki /var/www/html
the skin (the design and the css and js and images of the wiki) are still in /usr/share/mediawiki/skins which is not accessible by web server.
Make them accessible:
cp -a /usr/share/mediawiki/skins /var/www/html/wiki
or
ln -s /usr/share/mediawiki/skins /var/www/html/wiki/skins

Running the Installer

Navigate to localhost/wiki with your favorite browser.
If you are accessing that page for the first time, it would ask you to setup the wiki.
Follow that link which should take you to the setup page.
Fill in everything and click install button.
Create a new Mysql user (suggested by the installer)
Fill if you want a database prefix.
if everything goes right, MediaWiki installation successful page will be displayed.
LocalSettings.php has to be moved from config/ directory to the parent directory.
mv /var/www/html/wiki/config/LocalSettings.php /var/www/html/wiki
Delete the config directory for security reasons.
rm -fr /var/www/html/wiki/config

and that´s it!! :D
I'm not an expert so if you have any comment, correction, addition, question just let me know ;)
I hope to upload a video in a few days so if you have a suggestion also let me know

Troublesutting

PHP source code in localhost/wiki
Restart your httpd server

Permission Denied error
The minimum required for the wiki files and directories is
chmod 644
so check using ls -l
Also, you may need to change SELinux configuration
setsebool -P httpd_read_user_content 1
setbebool -P httpd_enable_homedirs 1
more info about SELinux

References

http://www.mediawiki.org/wiki/Manual:Installation_requirements
http://www.mediawiki.org/wiki/Download_from_Git
http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Fedora
http://www.wikihow.com/Install-MediaWiki-on-Fedora
http://www.mediawiki.org/wiki/SELinux