**Installing**

**BiomedGT LexWiki**

Semantic MediaWiki

Alpha 1.2

Revision Document History

  ---------- ------------- ---------------------------------- ---------------------
  **Date**   **Version**   **Description**                    **Author**

  9/21/07    1.0           First draft                        David Yee

  10/9/07    1.1           Added ant script instructions when David Yee
                           installing MediaWiki extensions.   

  10/10/07   1.2           Modified Installing MediaWiki      David Yee
                           Extensions section. In addition,   
                           made some minor changes through    
                           out this document.                 
  ---------- ------------- ---------------------------------- ---------------------

Table of Contents

1\. Introduction [4](#introduction)

1.1 Purpose [4](#purpose)

2\. Install LexWiki [4](#install-lexwiki)

2.1.1 Install XAMPPlite [4](#install-xampplite)

2.1.2 Uninstall XAMPPlite (XAMPPlite Version)
[5](#uninstall-xampplite-xampplite-version)

2.1.3 Install Apache (XAMPPlite Version)
[5](#install-apache-xampplite-version)

2.1.4 Uninstall Apache (XAMPPlite Version):
[5](#uninstall-apache-xampplite-version)

2.1.5 Install MySQL (XAMPPlite Version)
[6](#install-mysql-xampplite-version)

2.1.6 Uninstall MySQL (XAMPPlite Version)
[6](#uninstall-mysql-xampplite-version)

2.1.7 Install MediaWiki (Windows Version)
[6](#install-mediawiki-windows-version)

2.1.8 Installation of MediaWiki (Linux Version)
[6](#installation-of-mediawiki-linux-version)

2.1.9 Install MediaWiki (via Web Browser)
[7](#install-mediawiki-via-web-browser)

3\. Installing MediaWiki Extensions
[15](#installing-mediawiki-extensions)

3.1.1 Installing MediaWiki Extensions (via Ant Script)
[15](#installing-mediawiki-extensions-via-ant-script)

3.1.2 Installing MediaWiki Extensions (Manually)
[17](#installing-mediawiki-extensions-manually)

3.1.3 Downloading Latest MediaWiki Extensions
[18](#downloading-latest-mediawiki-extensions)

3.1.4 Installing MediaWiki extension
[18](#installing-mediawiki-extension)

3.1.5 Example of Extension Section of the LocalSettings.php File
[18](#example-of-extension-section-of-the-localsettings.php-file)

3.1.6 Preparing Database for Semantic MediaWiki
[19](#preparing-database-for-semantic-mediawiki)

4\. Miscellaneous [21](#miscellaneous)

4.1.1 Update Logo on the Main Page [21](#update-logo-on-the-main-page)

4.1.2 Update MediaWik Favorite Icon (favicon.ico)
[22](#update-mediawik-favorite-icon-favicon.ico)

4.1.3 Exporting (Backing up) MySQL Database to a File
[22](#exporting-backing-up-mysql-database-to-a-file)

4.1.4 Import MySQL Database from a File
[22](#import-mysql-database-from-a-file)

4.1.5 Upload Concepts via XML file [22](#upload-concepts-via-xml-file)

# Introduction

## Purpose

The purpose of this document is to guide a user to install the LexWiki
on a Windows and/or Linux machine. Note: I've only documented the steps
I tried.

# Install LexWiki

This document lists the steps to perform a Windows and Linux install of
the LexWiki. The easiest way to install the LexWiki is to use the
XAMPPlite package. This installation package includes Apache, MySQL,
PHP, and PERL. Although it contains all these applications, you can
still use your local instance (if they are already installed).

For a Windows machine (See the following sections on their specific
installation instructions):

-   Install XAMPPlite,

    -   Install Apache (XAMPPlite version) (if not already installed),

    -   Install MySQL (XAMPPlite version) (if not already installed),

-   Install MediaWiki (Windows Version),

-   Install MediaWiki (via Web Browser).

-   Installing MediaWiki Extensions (via Ant Script)

For Linux machine (See the following sections on their specific
installation instructions):

-   Install MediaWiki (Linux Version),

-   Install MediaWiki (via Web Browser).

-   Installing MediaWiki Extensions (via Ant Script)

### Install XAMPPlite

Download the latest version from:

-   <http://www.apachefriends.org/en/xampp-windows.html>

-   The current version at the time of writing this document:

    -   xampplite-win32-1.6.3a.exe

To install XAMPPlite

-   Double click on downloaded file.

-   Extract to c:\\temp directory.

-   Move c:\\temp\\xampplite to c:\\xampplite.

The follow instructions were taken from the readme_en.txt file located
in the xampplite subdirectory. These instructions were modified for this
document. Please refer to this file if you are experiencing any
problems.

-   To begin the installation, run the \"setup_xampp.bat\".

    -   Note: XAMPPlite makes no entries in the windows registry and no
        settings for the system variables.

-   If installation ended successfully:

    -   Start Apache 2 with \"apache_start\".bat\",

        -   If not install, see "Install Apache" instructions.

    -   Start MySQL with \"mysql_start\".bat\".

        -   If not install, see "Install MySQL" instructions.

    -   Stop MySQL Server with \"mysql_stop.bat\".

    -   Shutdown Apache HTTPD, close the Apache Command.

-   Start your browser and type http://127.0.0.1 or http://localhost in
    the location bar. You should see our pre-made start page with
    certain examples and test screens.

### Uninstall XAMPPlite (XAMPPlite Version)

-   Shutdown the apache and mysql.

-   Remove the \"XAMPPlite\" Directory.

### Install Apache (XAMPPlite Version)

-   In Command Prompt,

    -   cd c:\\xampplite

    -   apache_installservice.bat

    -   If this command fails, modify apache_installservice.bat with
        following change:

        -   From: bin\\apache -k install

        -   To: apache\\bin\\apache -k install

### Uninstall Apache (XAMPPlite Version):

-   Note: I have not tried these steps.

-   In Command Prompt,

    -   cd c:\\xampplite

    -   apache_stop.bat

    -   apache_uninstallservice.bat

### Install MySQL (XAMPPlite Version)

-   Note: I have not tried these steps.

-   In Command Prompt,

    -   cd c:\\xampplite\\mysql

    -   mysql_installservice.bat

### Uninstall MySQL (XAMPPlite Version)

-   Note: I have not tried these steps.

-   In Command Prompt,

    -   cd c:\\xampplite\\mysql

    -   mysql_uninstallservice.bat

### Install MediaWiki (Windows Version)

Download the latest version from:

-   <http://www.mediawiki.org/wiki/Download>

-   The current version at the time of writing this document:

    -   mediawiki-1.11.0.tar.gz

Using WinZip:

-   Extract the contents from the tar.gz file into
    c:\\xampplite\\htdocs.

    -   tar -xvzf /tmp/mediawiki-\*.tar.gz

-   Rename mediawiki-\[VERSION\] to lexwiki.

Continue instruction from "Install MediaWiki (via Web Browser)" section.

### Installation of MediaWiki (Linux Version)

There is a XAMPPlite Linux version:

-   <http://www.apachefriends.org/en/xampp-linux.html>

*Note: Our current development machine already had Apache, MySQL, and
PHP installed. Since I did not witness the installation of these
applications, I did not document them. I only installed the latest
version of the MediaWiki.*

Download the latest version:

-   <http://www.mediawiki.org/wiki/Download>

-   The current version at the time of writing this document:

    -   mediawiki-1.11.0.tar.gz

The following commands require sudo privileges. If you are not the super
user, just prefix each command with the word sudo. There is a time out
period when using this command. Occasionally, you will be prompted to
re-enter your password.

-   Download tar.gz file to /tmp

-   cd /usr/local

-   tar -xvzf /tmp/mediawiki-\*.tar.gz

-   ln --s mediawiki\* lexwiki

You need to configure Apache and then restart:

-   Add the following lines to
    /usr/local/apache2/conf/vhosts/mediawiki.conf:

> Alias /lexwiki /usr/local/lexwiki
>
> \<Directory /usr/local/lexwiki/\>
>
> Options Indexes FollowSymLinks MultiViews
>
> AllowOverride AuthConfig
>
> \</Directory\>

Then you need to restart Apache:

-   cd /usr/local/apache2/bin

-   ./httpd --k restart

Continue instruction from "Install MediaWiki (via Web Browser)" section.

### Install MediaWiki (via Web Browser)

Follow instructions were taken from the following URL:

-   <http://www.mediawiki.org/wiki/Manual:Simple_Windows_Apache_Installation>

These instructions were modified for this document. Please refer to this
URL if you are experiencing any problems.

-   Navigate your browser to:

    -   <http://localhost/lexwiki/index.php>, or

    -   <http://SERVER_NAME/lexwiki/index.php>

```{=html}
<!-- -->
```
-   You should see the MediaWiki welcome screen and the message:

    -   Please set up the wiki first.

-   Click on the link.

-   Following figures show you how to fill out this form (if you wish,
    you could use these values as shown):

![](media/image2.jpeg){width="7.495138888888889in" height="3.54375in"}

-   Enter the Wiki name,

-   Enter your contact e-mail,

-   Enter your language,

![](media/image3.jpeg){width="7.4944444444444445in" height="4.4625in"}

-   For Copyright/license:

    -   Select A Creative Commons license,

    -   Select "choose" link.

![](media/image4.jpeg){width="7.495138888888889in"
height="5.225694444444445in"}

-   Select "Select a License" button.

-   Creative Commons page is displayed.

-   Select the "proceed" link.

![](media/image5.jpeg){width="7.495138888888889in"
height="2.7395833333333335in"}

![](media/image6.jpeg){width="7.4944444444444445in" height="6.64375in"}

![](media/image7.png){width="7.4944444444444445in"
height="5.521527777777778in"}

-   For database type, select MySQL.

-   For database name, enter lex_wiki.

    -   *Note: We are backing up (or exporting) our database under this
        name. If you plan to import the tables from this database,
        please keep the database name as lex_wiki*.

-   For DB username, enter any value you wish.

-   For DB password, enter any value you wish.

-   If you have superuser privileges, check "Use superuser account".

-   For Superuser name, enter the root name.

-   For Superuser password, enter the root password.

![](media/image8.jpeg){width="7.4944444444444445in"
height="5.829166666666667in"}

-   For database table prefix, enter lw\_.

    -   *Note: We are backing up (or exporting) our tables with this
        prefix. If you plan to import the tables, please keep the
        database table prefix as lw\_*.

-   For Storage Engine, select InnoDB.

-   For Database character set, select Backwards-compatible UTF-8.

```{=html}
<!-- -->
```
-   For Windows machines:

```{=html}
<!-- -->
```
-   Select "Install MediaWiki!" button.

-   You will see the installation successful message.

-   NOTE: if you see an error message regarding \"there is no database
    driver\". You will need to edit your php.ini.

    -   Install the mysql extension.

    -   Make sure \";\" in front of extension=php_mysql.dll has been
        removed.

    -   Above that, add this line -\> extension_dir=\"C:\\php\\ext\".

        -   This must be added above the \"extension=php_mysql.dll\".

        -   This will set the php to look in the correct directory for
            the extensions.

-   Restart PC. (or restart the apache service)

-   Finally, follow the instructions and

    -   Move c:\\xampplite\\htdocs\\lexwiki\\config\\LocalSettings.php

    -   To c:\\xampplite\\htdocs\\lexwiki\\LocalSettings.php.

-   Click the link <http://localhost/lexwiki/index.php/Main_Page>

    -   You should see MediaWiki software successfully installed
        message.

```{=html}
<!-- -->
```
-   For Linux machines:

```{=html}
<!-- -->
```
-   Select Install MediaWiki!" button.

-   You will see the installation successful message.

-   Finally, follow the instructions and

    -   Move c:/usr/local/lexwiki/config/LocalSettings.php

    -   To c:/usr/local/lexwiki/LocalSettings.php.

```{=html}
<!-- -->
```
-   Click the link <http://localhost/lexwiki/index.php/Main_Page>

    -   You should see MediaWiki software successfully installed
        message.

# Installing MediaWiki Extensions

In this document, there are two approaches listed that install the
MediaWiki extensions:

-   Installing MediaWiki Extensions (via Ant Script)

-   Installing MediaWiki Extensions (Manually)

The preferred method is using the ant script. The manual method is
listed as a reference if you are experiencing any problems. It provides
general knowledge how to install these extensions.

### Installing MediaWiki Extensions (via Ant Script)

There is an ant script (build.xml) that installs the extensions and any
modifications NCI has made to the MediaWiki sources. This xml file
requires the build.properties file which allows you to set the
properties of your environment. You need to modify this properties file
and specify the following:

-   Ant's home directory,

-   LexWiki home directory

    -   You could also specify a test location to see how the files are
        installed. You could then manually copy or move these files to
        the proper LexWiki home subdirectories.

In temporary directory, these files can be checked out from the
following Subversion (SVN) repository:

-   <https://gforge.nci.nih.gov/svnroot/protegegui/collaborativedevterminologytools/SMW_NCI/trunk/lexwiki>

In the Command Prompt or Linux shell,

-   "cd" to this temporary directory,

-   ant setup_env

This ant command installs:

-   Required base MediaWiki extensions,

-   NCI's modifications to these extensions,

-   NCI extensions,

-   NCI's modifications to the MediaWiki sources.

Note: In order for this ant script to work, you need to install the
following on your machine:

-   Apache Ant

-   JRE

-   SVN Ant

You can check out these installers from:

-   <https://gforge.nci.nih.gov/svnroot/protegegui/collaborativedevterminologytools/SMW_NCI/trunk/installers/>

Since every MediaWiki environment is different, you still need to modify
the LocalSettings.php file (See Example of Extension Section of the
LocalSettings.php File section). You can also use the LocalSettings.php
file from SVN as an example.

Display your LexWiki in your browser:

-   Navigate your browser to:

    -   <http://localhost/lexwiki/index.php>, or

    -   <http://SERVER_NAME/lexwiki/index.php>

```{=html}
<!-- -->
```
-   If you are experience any problems, try:

    -   See "Preparing Database for Semantic MediaWiki" section

    -   Refresh your browser or redisplay lexwiki/index.php

```{=html}
<!-- -->
```
-   The base LexWiki should be displayed.

-   You still need to import the tables into your instance of MySQL.

The following are some addition steps to configure the MediaWiki. You
can go to each individual section.

-   Update Logo on the Main Page.

-   Update Favorite Icon (favicon.ico) for the MediaWiki.

-   Exporting (Backing up) MySQL Database to a File.

-   Import MySQL Database from a File.

-   Upload Concepts via XML file.

### Installing MediaWiki Extensions (Manually)

To load each extension, follow the directions from the "Installing
MediaWiki Extension" section. The following is a list of extensions that
are currently required by the LexWiki. In the future, this list will
most likely change.

-   CategoryTree,

-   DynamicPageList2,

-   ExpandTemplates,

-   Graph

    -   This extension does not exist in MediaWiki SVN. This was copied
        from cbiovdev5039.

-   ParserFunctions,

-   SemanticForm,

-   SemanticMediaWiki,

    -   Also see "Preparing Database for Semantic MediaWiki",

```{=html}
<!-- -->
```
-   StringFunctions

    -   This extension does not exist in MediaWiki SVN. See:

        -   http://www.mediawiki.org/wiki/Extension:StringFunctions

-   VocPortalExtensions

It might be easier to download the complete set (see "Downloading Latest
MediaWiki Extensions") and then manually copy the needed files to the
extension directory. If you are unsure of your LocalSettings.php file
changes, you can glance at the "Example of Extension Section of the
LocalSettings.php File" section.

The following are some addition steps to configure the MediaWiki. You
can go to each individual section.

-   Update Logo on the Main Page.

-   Update Favorite Icon (favicon.ico) for the MediaWiki.

-   Exporting (Backing up) MySQL Database to a File.

-   Import MySQL Database from a File.

-   Upload Concepts via XML file.

### Downloading Latest MediaWiki Extensions

The following URL lists all the MediaWiki extensions.

-   <http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/>.

To download the complete set:

-   In Linux, using the shell,

    -   svn co
        <http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/>

```{=html}
<!-- -->
```
-   In Windows, using the Command Prompt:

    -   svn co
        <http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/>

### Installing MediaWiki extension

The following URL contains links to all the extensions:

-   <http://www.mediawiki.org/wiki/Category:All_extensions>

To install an extension, select its specific link. Then follow the
installation instructions in this page. Each extension has it own
specific installation instructions. Most of them require:

-   Copying the specific .php files to the extension directory,

-   Adding an entry to the LocalSettings.php file.

### Example of Extension Section of the LocalSettings.php File

The following is an example taken from LocalSettings.php file after the
extensions were installed. Note: This does not show the complete content
of the LocalSettings.php file.

> #A list of VocPortal Servers to monitor
>
> #Servers are searched in the order listed below
>
> \$vpServers = array (
>
> #\"http://63.126.41.248:8081/cocoon/vocPortal/\");
>
> \"http://cbiovdev5011.nci.nih.gov:59180/cocoon/vocPortal/\");
>
> \# Enable Ajax for the category tree
>
> \$wgUseAjax = true;
>
> require_once(\"\$IP/extensions/ParserFunctions/ParserFunctions.php\"
> );
>
> require_once(\"\$IP/extensions/StringFunctions/StringFunctions.php\");
>
> require_once(\"\$IP/extensions/VocPortalExtensions/VocPortalExtension.php\");
>
> #require_once(\"\$IP/extensions/VocPortalExtensions/TerminologyURLExtension.php\");
>
> require_once(\"\$IP/extensions/VocPortalExtensions/LexWikiExtension.php\");
>
> require_once(\"\$IP/extensions/ExpandTemplates/ExpandTemplates.php\");
>
> require_once(\"\$IP/extensions/CategoryTree/CategoryTree.php\");
>
> include_once(\"\$IP/extensions/Graph/Graph.php\");
>
> require_once(\"\$IP/extensions/MayoExtension/articletocategory.php\");
>
> require_once(\"\$IP/extensions/DynamicPageList2/DynamicPageList2.php\");
>
> require_once(\"\$IP/extensions/SemanticMediaWiki/includes/SMW_Settings.php\");
>
> require_once(\"\$IP/extensions/SemanticForms/includes/SF_Settings.php\");
>
> enableSemantics(\'localhost\');
>
> enableSemanticForms();

### Preparing Database for Semantic MediaWiki

After installing the Semantic MediaWiki extension, you have to prepare
the database. You must log in as WikiSysop:

-   Select "log in" link (located on the top right corner)

-   Login as WikiSysop,

-   Display the following URL:

    -   <http://localhost/lexwiki/index.php/Special:SMWAdmin>

    -   If you get a "No such special page message" displayed, comment
        both the require_once for SemanticForm and enableSemanticForms()
        statements (see below):

        -   include_once(\"\$IP/extensions/SemanticMediaWiki/includes/SMW_Settings.php\");

        -   #require_once(\"\$IP/extensions/SemanticForms/includes/SF_Settings.php\");

        -   enableSemantics(\'localhost\');

        -   #enableSemanticForms();

    -   Redisplay the SMWAdmin page.

![](media/image9.jpeg){width="6.791666666666667in"
height="6.010416666666667in"}

-   Click on "Initialise or upgrade tables" button.

-   The following page is displayed:

![](media/image10.jpeg){width="5.614583333333333in" height="5.78125in"}

# Miscellaneous

### Update Logo on the Main Page

You can change the logo (located to the top left of each page). The
following steps use EVS_logo.gif as an example:

-   Create or copy an image to
    C:\\xampplite\\htdocs\\lexwiki\\images\\EVS_logo.gif

-   Add or edit the follow line to LocalSettings.php:

    -   \$wgLogo = \"\$wgScriptPath/images/EVS_logo.gif\";

### Update MediaWik Favorite Icon (favicon.ico)

Favicon are those small icons located in the address bar. To custom your
own icon:

-   Use the following URL to create an icon file:

    -   <http://tools.dynamicdrive.com/favicon/>

```{=html}
<!-- -->
```
-   Windows:

    -   Replace the favicon.ico in C:\\xampplite\\htdocs directory with
        your icon.

### Exporting (Backing up) MySQL Database to a File

You can use the export command to either backup the current database or
transfer the data to a different database.

-   Linux:

    -   In the shell window,

        -   mysqldump -h cbiodb590.nci.nih.gov -P 3629 -u lex_wiki -p
            lex_wiki \> lw_backup.sql

```{=html}
<!-- -->
```
-   Windows:

    -   Using HeidiSQL application:

        -   Right Mouse on database (lex_wiki)  Export tables as SQL.

        -   Uncheck lw_objectcache.

        -   Select Destination tab.

        -   Enter the desired Output File name.

        -   Select Export button.

### Import MySQL Database from a File

Using the exported MySQL file (See "Exporting (Backing up) MySQL
Database" section), you can import data to your database.

-   Windows:

    -   In the Command Prompt,

        -   cd c:\\Program Files\\MySQL\\MySQL Server 5.0\\bin

        -   mysql --u root --p \< EXPORTED_OR_DUMP_SQL.file

### Upload Concepts via XML file

The following URL imports wiki content using XML files:

-   <http://localhost/lexwiki/index.php?title=Special:PrimeGraph>.

![](media/image11.jpeg){width="6.229166666666667in" height="4.0625in"}

-   The following is an example of an XML file to be uploaded. There is
    upload processing limit on the file size. If you are experience
    problems, split the file.

> \<list\>
>
> \<namespace\>NCI
>
> \</namespace\>
>
> \<version\>07.05e
>
> \</version\>
>
> \<nodelist\>
>
> \<node code=\'C20181\' name=\'Conceptual_Entity\'/\>
>
> \<node code=\'C459\' name=\'Medication\'/\>
>
> \<node code=\'C1312\' name=\'Generic_Drug\'/\>
>
> \<node code=\'C25759\' name=\'Clinical_Study_Element\'/\>
>
> \<node code=\'C753\' name=\'Placebo\'/\>
>
> ...
>
> ...
>
> ...
>
> \<node code=\'C64948\' name=\'Administration_via_Fistula\'/\>
>
> \<node code=\'C64984\'
> name=\'Intracameral_Route_of_Administration\'/\>
>
> \<node code=\'C65131\'
> name=\'Transurethral_Route_of_Administration\'/\>
>
> \<node code=\'C25175\' name=\'Filed\'/\>
>
> \</nodelist\>
>
> \</list\>

-   Browse to the XML file.

-   Select the "Upload file" button.