Installing Mediawiki on Debian
April 17, 2014 Leave a comment
If you have an existing Debian installation, skip right to the "Installing Mediawiki" section. Otherwise, start with the "Preparing the Server" section.
PREPARING THE SERVER
The quickest way to get up-and-running, particularly if you are simply evaluating Mediawiki, is to use a pre-installed Debian virtual machine.
NOTE: Alternately, you can set up Debian from scratch on a computer or in a virtual machine. That process is beyond the scope of these instructions. Refer to the Debian website for guidance.
To use a pre-installed virtual machine, follow these steps:
Install VirtualBox, if you do not already have it. It can be downloaded from https://www.virtualbox.org/.
Download the appropriate pre-installed virtual machine from http://virtualboxes.org/. For this tutorial, Debian 6.0.6 with GNOME was selected.
Set up the virtual machine in VirtualBox.
Start the virtual machine and log in.
From the System/Administration menu, select Synaptic Package Manager. You will be required to enter an administrative password.
Use the Package Manager to search for "openssl". If the installed version is between versions 1.0.1 and 1.0.1f (inclusive), it is vulnerable to the Heartbleed bug. Do the following to upgrade it:
- Mark the "openssl" package for installation.
- If prompted to install/upgrade packages dependent on openssl, mark all of the additional packages for install/upgrade.
- Click the "Apply" button at the top of the Package Manager window. Click the Apply button in the resulting dialog to confirm the changes.
- When prompted, close the dialog that reports that all changes were applied. If you wish, review the details of the updates before closing the dialog.
Install Mediawiki by following these steps:
From the Applications/Accessories menu, select Root Terminal to open a command prompt with administrative privileges. When prompted, enter the administrative password.
Update the list of package sources by typing
Install the MySQL database management system by typing
apt-get install mysql-client mysql-common mysql-server
When prompted, set a password for the "root" MySQL user.
After the MySQL installation completes, open a MySQL command prompt by typing
mysql -u root -p <password>
Create a new MySQL user named "mediawiki" and a password of "mediawiki" by typing
create user ‘mediawiki’ identified by ‘mediawiki’;
Create a new database named "mediawiki" and grant the new "mediawiki" user rights by typing
create database mediawiki;
grant index, create, select, insert, update, delete, alter, lock tables on mediawiki.* to ‘mediawiki’@’localhost’ identified by ‘mediawiki’;
Type "exit" to leave the MySQL command prompt.
apt-get install apache2 libapache2-mod-php5 php5 php5-common php5-cli php5-mysql php5-mcrypt php5-curl php5-gd php5-intl php-pear
Install Mediawiki and all extensions by typing
apt-get install mediawiki mediawiki-extensions
This may take a while (30-60 minutes).
Open the php.ini file in the gedit text editor by typing
Make the following modifications…
max_execution_time = 300
max_input_time = 120
memory_limit = 20M
as well as these additions…
When done, close gedit.
By default, Mediawiki is installed in /var/lib/mediawiki, rather than the default apache root folder. Use gedit to open the 000-default configuration file by typing
Look for "DocumentRoot /var/www" and replace it with "DocumentRoot /var/lib/mediawiki". Similarly, replace "<Directory /var/www/>" with "<Directory /var/lib/mediawiki/>". When done, close gedit.
Restart the apache service by typing
service apache2 restart
Start a web browser and navigate to http://localhost/config
Review the page and verify that the environment checks out and that you have been given the message "You can install MediaWiki".
Fill out all required information. For testing in a VM, you probably want to turn off all "E-mail" features. Use the MySQL database information specified when installing MySQL to complete the "Database config" section.
When done, click the "Install MediaWiki!" button.
If everything completes successfully, you should see the message "Installation successful!", as well as directions for moving/installing the LocalSettings.php file.
Move the LocalSettings.php file as directed. (For example, move /var/lib/mediawiki/config/LocalSettings.php to /etc/mediawiki.)
Navigate to http://localhost/index.php to see the home page of your newly installed Mediawiki instance.
RESETTING THE ADMIN PASSWORD
After completing the installation, I had a problem logging in using the administrative account. I do not know if I made a mistake entering the password during the installation, or if there was a problem with the installation process itself. So, just in case it is needed, here are the steps to reset the Mediawiki administrator password:
Open a Debian command prompt with administrative rights.
Navigate to the maintenance folder of the mediawiki installation (i.e. /var/lib/mediawiki/maintenance).
Change the password by typing
php changePassword.php –user=<adminusername> –password=<adminpassword>
ACCESSING MEDIAWIKI FROM THE HOST (VM INSTALL ONLY)
If you have installed Mediawiki in a virtual machine, and you want to access it from the host machine, follow these steps (originally described at http://stackoverflow.com/questions/6117610/how-to-access-oracle-db-in-virtualbox-from-host-windows):
With the virtual machine turned off, use the VirtualBox Manager to open the Settings dialog for the virtual machine.
Navigate to the "Network" tab.
Adapter 1 should be enabled and attached to "NAT". Leave this adapter active, as it will allow the virtual machine to access the Internet via the host machine’s network connection.
Go to Adapter 2, check the "Enable network adapter" box, and set the value of the "Attached To" dropdown to "Host-only Adapter". This adapter will allow the virtual machine to be accessed from the host.
Start the virtual machine.
Hover over the network icon on the status bar and note the IP address. It should be similar to "192.168.56.101".
From a browser on the host machine, navigate to the IP address (i.e. http://192.168.56.101).
Similarly, to enable administration of the Mediawiki MySQL database from the host machine, do the following:
Within the virtual machine, open a command prompt with administrative rights.
Use gedit to open the file /etc/mysql/my.cnf and comment out the line
bind-address = 127.0.0.1
This allows MySQL to accept connections from something other than the local machine.
Restart the MySQL server by typing
service mysql restart
Open a MySQL command prompt by typing
mysql -u root -p <password>
Enable remote root access to MySQL by typing
grant all privileges on *.* to ‘root’@’%’ identified by ‘password’;