Semantic MediaWiki installation

From AIRWiki
Jump to: navigation, search

This is a quick and dirty guide to install MediaWiki and its semantic extension from scratch. It is built to work with currently latest versions of the softwares, so you'll probably have to check if there's something new outside before repeating all the described steps (however, all the latest versions had the same installation procedure so it should not differ much from this).

As a requirement, you should already have mysql and apache installed on your system, and have at least a basic knowledge of how they work. If not, go and study something! ;-)

Now the installation steps:

  • create the database for the MediaWiki installation: the following command creates one called "wikidb", with a login name "wikiuser" and a login pass "wikipass". The mysql command supposes your mysql installation already has a password set up for the root account. If not, just omit the "-p" switch, otherwise enter it when prompted.
echo "drop database wikidb;create database wikidb;grant all on wikidb.* to wikiuser@localhost identified by 'wikipass';" | mysql -u root -p
  • go to your DocumentRoot directory (it's the one set up in your apache configuration file: check in /etc/apache2/sites-enabled/yoursiteprofile, if you did not set up one it should be written inside 000-default) and type the following commands:
tar xvfz mediawiki-1.11.0.tar.gz
mv mediawiki-1.11.0 wiki
cd wiki
chmod a+w config
  • the previous commands download the MediaWiki 1.11.0 package (you can find the latest versions here), extract it in a directory that is renamed to "wiki", enters the directory and changes the permissions for the config dir. This will allow you to open your wiki inside the browser and configure it: just open a browser window and go to
  • choose to configure the system and set up all the needed parameters (db name, user and pass, admin name and pass, etc). After the process you'll be told to move the LocalSettings.php file to the root directory: go back to the shell and type the following commands
mv config/LocalSettings.php .
chmod a-wx config/
  • The wiki is now set up! Try to connect to the URL above and you should be able to see the main page of the wiki. Now, for the SMW extension installation (the last version should be available here), type the following inside the shell:
cd extensions
tar xvfz semediawiki-1.0.tar.gz
cd ..
echo -e "\ninclude_once('extensions/SemanticMediaWiki/includes/SMW_Settings.php');\nenableSemantics('elsewhere');" >>LocalSettings.php
  • the previous lines extract the downloaded extension in the "extensions" directory and enable it by adding two lines at the end of the LocalSettings.php file. The very last step is to open the wiki again, log in with the sysop/admin account, go to the Special:SMWAdmin page (which is reachable from the "Special Pages" list, check at the end of the page), and click on "Initialize or upgrade tables". This will set up the extension and your wiki will be semantically powered!