Installing Mediawiki on Debian

Here are the steps to follow to install Mediawiki on Debian.  It is assumed that GNOME is in use on Debian. Installation on Windows or other flavors of Linux may vary.

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:

Step 1

Install VirtualBox, if you do not already have it.  It can be downloaded from https://www.virtualbox.org/.

Step 2

Download the appropriate pre-installed virtual machine from http://virtualboxes.org/.   For this tutorial, Debian 6.0.6 with GNOME was selected.

Step 3

Set up the virtual machine in VirtualBox.

Step 4

Start the virtual machine and log in.

Step 5

From the System/Administration menu, select Synaptic Package Manager.  You will be required to enter an administrative password.

Step 6

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:

  1. Mark the "openssl" package for installation.
  2. If prompted to install/upgrade packages dependent on openssl, mark all of the additional packages for install/upgrade.
  3. Click the "Apply" button at the top of the Package Manager window.  Click the Apply button in the resulting dialog to confirm the changes.
  4. 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.

INSTALLING MEDIAWIKI

Install Mediawiki by following these steps:

Step 1

From the Applications/Accessories menu, select Root Terminal to open a command prompt with administrative privileges.  When prompted, enter the administrative password.

Step 2

Update the list of package sources by typing

apt-get update

Step 3

Install the MySQL database management system by typing

apt-get install mysql-client mysql-common mysql-server

Step 4

When prompted, set a password for the "root" MySQL user.

Step 5

After the MySQL installation completes, open a MySQL command prompt by typing

mysql -u root -p <password>

Step 6

Create a new MySQL user named "mediawiki" and a password of "mediawiki" by typing

create user ‘mediawiki’ identified by ‘mediawiki’;

Step 7

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’;
flush privileges;

Step 8

Type "exit" to leave the MySQL command prompt.

Step 9

Install the Apache HTTP server and PHP scripting language, along with all of the necessary add-ons, by typing

apt-get install apache2 libapache2-mod-php5 php5 php5-common php5-cli php5-mysql php5-mcrypt php5-curl php5-gd php5-intl php-pear

Step 10

Install Mediawiki and all extensions by typing

apt-get install mediawiki mediawiki-extensions

This may take a while (30-60 minutes).

Step 11

Open the php.ini file in the gedit text editor by typing

gedit /etc/php5/apache2/php.ini

Make the following modifications…

max_execution_time = 300
max_input_time = 120
memory_limit = 20M

as well as these additions…

extension=mysql.so
extension=gd.so

When done, close gedit.

Step 12

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

gedit /etc/apache2/sites-enabled/000-default

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.

Step 13

Restart the apache service by typing

service apache2 restart

Step 14

Start a web browser and navigate to http://localhost/config

Step 15

Review the page and verify that the environment checks out and that you have been given the message "You can install MediaWiki".

Step 16

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.

Step 17

When done, click the "Install MediaWiki!" button.

Step 18

If everything completes successfully, you should see the message "Installation successful!", as well as directions for moving/installing the LocalSettings.php file.

Step 19

Move the LocalSettings.php file as directed.  (For example, move /var/lib/mediawiki/config/LocalSettings.php to /etc/mediawiki.)

Step 20

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:

Step 1

Open a Debian command prompt with administrative rights.

Step 2

Navigate to the maintenance folder of the mediawiki installation (i.e.  /var/lib/mediawiki/maintenance).

Step 3

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):

Step 1

With the virtual machine turned off, use the VirtualBox Manager to open the Settings dialog for the virtual machine.

Step 2

Navigate to the "Network" tab.

Step 3

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.

Step 4

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.

Step 5

Start the virtual machine.

Step 6

Hover over the network icon on the status bar and note the IP address.  It should be similar to "192.168.56.101".

Step 7

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:

Step 1

Within the virtual machine, open a command prompt with administrative rights.

Step 2

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.

Step 3

Restart the MySQL server by typing

service mysql restart

Step 4

Open a MySQL command prompt by typing

mysql -u root -p <password>

Step 5

Enable remote root access to MySQL by typing

grant all privileges on *.* to ‘root’@’%’ identified by ‘password’;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: