Thursday, January 18, 2007

How to Create Your Own Wiki

I'm sure you've heard of Wikipedia. But what if you could run your own such site? For me, I need a wiki for documentation of my projects internally, but I can see small companies or business units using such a solution to share information or document various policies and procedures. If you have a lot of static documents sitting around your network, a wiki might be a good idea.

The technology behind Wikipedia is Wikimedia, an open-source wiki engine. Wiki engines were originally built for Linux platforms running Apache webservers, open-source or free databases such as MySQL, and easy-to-use scripting languages such as PHP (and thus the acronym LAMP). As such, the most popular implementations of wikis require good knowledge of these 4 technologies. Fortunately, anyone can install and run their own wiki without knowing too much about them.


Prepare Your System
These steps demonstrate how to install Wikimedia on a Windows-based machine using the Saint AMP suite. I do not delve into issues involving having other web servers (such as IIS or application server containers) or databases already running on the system.


Download Software Required
(1)
The Saint AMP Suite (3.4.0): package that includes Apache webserver, MySQL database, and PHP - all designed to work together. Because it is installed as a single application (called a stack), you'll get running much sooner, and do not have to learn PHP or MySQL.
(2) Wikimedia (1.9.0): the wiki engine itself.

Install The Saint WAMP (TSW)
  • Run the TSW executable. Language=English [OK]. Review the welcome message and accept the licence.
    Choose Components: Full WAMP, everything selected. [Next].
  • Choose Install Location: Minimum space required is 160MB. Consider that the database will grow as users create pages and upload files. [Next].
  • Apache global options: provide an email, change the HTTP port for the webserver to use (81, for example, if you have another webserver listening on 80). Leave server name as 127.0.0.1 for portability. [Next].
  • Module Activation: Choose only mod_dav2, mod_gzip, and mod_status. We don't care about the others since we won't be using SSL or integrating with Python engines or IIS/ASP. [Next]
  • Database Options: mysqld-nt.exe. This is the service that'll run the database and listen on port 3306, the default MySQL port. [Next].
  • FileZilla FTP: defaults to listen on port 14147. Leave defaults and click [Next].
  • Start Menu Folder: cleanup the name as how it should appear in Start > Programs. [Install].
  • During installation, a "Connect to Server" dialog will popup. This is the FileZilla service request. Select Always connect to this server and click [OK]. You can close the window.
  • When installation finishes, ensure that the Do you want to start Apachemon now? checkbox is selected and click [Finish].
  • In the taskbar, double-click the Apache Monitor, highlight the TSW-Contentserver and click [Start]. Click [OK] to close the monitor dialog.
  • Ensure MySQL is started (Start > Programs > The Saint WAMP > DB > MySQL > Mysqld-start
  • Open your web browser and go to http://localhost:81/ (if you used port 81). A page should inform you on the success of the installation.

Configure Apache2

Configure the Apache webserver admin account:

  • Open the DOS console (Start > Run ... and type 'cmd').
  • Browse to $tsw$\Apache2\bin. ($tsw$ is the folder where you installed TSW above).
  • Run "htpasswd -cmd .htpasswd ". Replace with the username of the admin account. You are prompted to assign and confirm a password.
  • Run "copy .htpasswd ..\conf". Confirm a file replace. This replaces the default Apache admin account with one you just created.

Change the Apache DocumentRoot - where web documents are stored.

  • Open Windows Explorer and browse to $tsw$\Apache2\conf. Open the httpd.conf file.
  • Find 'DocumentRoot' and assign it an alternative directory, perhaps on a drive with more space or simply outside the folder context of the web server (security measure, maintenance ease).
  • Also change htdocs inside '' to the full name of the sirectory specified above.
    Stop and restart the TSW-Contentserver in the Apache Monitor for changes to take effect.
  • Open http://localhost:3000/ using the admin account iinfo you created above to view various aspects of the server. This is your system's administration console pretty much.

Install Wikimedia

  • Open the Wikimedia package with Winzip, and extract the included compressed file to the DocumentRoot folder of the Apache2 webserver (make sure you use folder structure while extracting).
  • Rename the extracted directory to wiki. (Called $wiki$).
  • Open http://localhost:81/wiki/ to configure the wiki engine for the first time.
    Site Config: provide a wiki name.
    Site Config: provide the admin username and password (for a new wiki account).
    Database Config: provide DB username/password (for a new MySQL account).
    Database Config: check the 'Use superuser account' option - used to create the above account.
    MySQL Options: provide a table prefix for all tables created in MySql for the wiki.
    Click [Install Wikimedia].
  • Move the $wiki$\config\LocalSettings.php to the $wiki$ folder.
  • The wiki can be accessed at http://localhost:81/wiki/.

At this point, your wiki works just like Wikipedia. If you are new to wikis, you should peruse the Wiki User Guide to learn how to add content.