SMWp Setup: Mac OS X

The following notes cover installation of the packages described in SMW+ Setup on an (Intel-based) Mac Pro, running Mac OS X 10.6.1 (and probably 10.5.8).

Approaches

As noted on SMW+ Setup, it is possible to install an integrated copy of SMW+ under Microsoft Windows. This should also be a possibility under Mac OS X, using a Virtual Machine such as VMware. However, I want to use SMW+ in a Unixish context and manner, so I chose the latter (though more complicated) approach.

That said, if you are comfortable with a Windows-based solution, give it a try! If and when you get it working, please send me any notes on problems, workarounds, etc.

Packages

MediaWiki requires a working database server (eg, MySQL) and a working web (ie, HTTP) server (eg, Apache). The web server supports a stack of several packages: PHP, MediaWiki, Semantic MediaWiki, and Halo. We'll install MySQL first, then work our way through the web stack.

MySQL

Download and Install

  • Click on "MySQL 5.1 -- Generally Available (GA) release for production use".

  • Under "MySQL Community Server", click the Download button.

  • Click on "Mac OS X (package format)".

  • In the "Mac OS X 10.5 (x86_64)" line, click on "Pick a mirror".
    (If you have a 32-bit Mac, use the "Mac OS X 10.5 (x86)" line.)

  • Register and/or log in.

  • Select a Mirror (download server).

  • If desired, move the DMG archive to a more appropriate location.

  • Double-click on the DMG archive (eg, mysql-5.1.40-osx10.5-x86_64.dmg).

  • Drag the ReadMe.txt file to the current directory, then double-click it and skim the contents.

  • Double-click on the installer package (eg, mysql-5.1.40-osx10.5-x86_64.pkg).

  • To cause MySQL to start automatically during system startup, double-click MySQLStartupItem.pkg and follow the instructions.

Configure and Test

  • Add MySQL to the shell's PATH. For example, edit your $HOME/.profile file, adding:
    export PATH=/usr/local/mysql/bin:$PATH
    

  • Reboot the operating system, log in, etc.

  • Check for the presence of an accessible mysql command and a running MySQL server:
    spot:~ rdm$ which mysql
    /usr/local/mysql/bin/mysql
    spot:~ rdm$ mysql --version
    mysql  Ver 14.14 Distrib 5.1.40, for apple-...
    

  • Eliminate MySQL's "anonymous" accounts and set a password for MySQL's root accounts. Replace host_name and root_pwd as appropriate:
    spot:~ rdm$ mysql -u root
    mysql> DROP USER ''@'localhost';
    mysql> DROP USER ''@'host_name';
    mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root_pwd');
    mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('root_pwd');
    mysql> select host, user from mysql.user;
    +-----------+------+
    | host      | user |
    +-----------+------+
    | 127.0.0.1 | root |
    | localhost | root |
    | host_name | root |
    +-----------+------+
    3 rows in set (0.00 sec)
    mysql> EXIT;
    Bye
    

  • Make sure root can't log in without a password and that root can log in with a password:
    spot:~ rdm$ mysql -u root
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    spot:~ rdm$ mysql -u root -p
    Enter password: **********
    mysql> EXIT;
    Bye
    

Apache HTTP Server

Apache is installed by default on Mac OS X, but it needs to be turned on.

Configure and Test

  • In the Apple menu, select the System Preferences application.

  • In the "Internet & Wireless" row, select the Sharing item.

  • Turn on "Web Sharing" (ie, Apache).

  • In a web browser (eg, Safari), go to http://localhost.
    Unless you get "Unable to connect", Apache is working.

PHP

PHP is installed by default on Mac OS X, but Apache has to be told to let it run.

Configure and Test

  • Make a copy of /etc/apache2/httpd.conf, then edit it, eg:
    spot:~ rdm$ t=/etc/apache2/httpd.conf
    spot:~ rdm$ sudo cp $t ${t}%
    spot:~ rdm$ sudo vi $t
    

  • Uncomment PHP's LoadModule line, as:
    LoadModule php5_module  libexec/apache2/libphp5.so
    

  • Restart Apache and create a test PHP file:
    spot:~ rdm$ sudo apachectl restart
    spot:~ rdm$ t=/Library/WebServer/Documents/test.php
    spot:~ rdm$ sudo echo '<? phpinfo(); ?>' > $t
    

  • In a web browser, go to http://localhost/test.php.
    You should see a detailed display of your PHP configuration.

MediaWiki

Pre-conditions

  • If there is no /tmp/mysql.sock (socket) file, set one up:
    spot:~ rdm$ ls /var/mysql/mysql.sock
    ls: /var/mysql/mysql.sock: No such file or directory
    spot:~ rdm$ sudo mkdir /var/mysql
    spot:~ rdm$ sudo ln -s /tmp/mysql.sock /var/mysql
    

  • Create the MySQL account and database for MediaWiki. Replace wikidb and wikiuser, if desired. Replace (and remember!) ***** as appropriate:
    spot:~ rdm$ mysql -u root -p
    Enter password: **********
    mysql> CREATE DATABASE wikidb;
    mysql> GRANT INDEX, CREATE, SELECT, INSERT, UPDATE, DELETE, ALTER, LOCK TABLES
        -> ON wikidb.* TO 'wikiuser'@'localhost' IDENTIFIED BY '*****';
    mysql> SET PASSWORD FOR 'wikiuser'@'localhost' = OLD_PASSWORD('*****');
    mysql> FLUSH PRIVILEGES;
    mysql> EXIT;
    Bye
    

Download and Install

  • In a new Finder window, navigate to the system disk drive.

  • Navigate to Library > WebServer > Documents

  • Create a folder (eg, SMWp_files) for the SMW+ files.

  • Click the big button (eg, "Download MediaWiki 1.15.1").

  • Move the compressed tar archive to the SMWp_files folder.

  • Double-click on the compressed tar archive (eg, mediawiki-1.15.1.tar.gz).

  • Drag the resulting folder (eg, mediawiki-1.15.1) up to the Documents folder.

  • Rename it AS mediawiki.

Configure and Test

  • MediaWiki uses a web-based configuration wizard. In order to use this, you must make the config directory writable by the web server.
    spot:~ rdm$ cd /Library/WebServer/Documents/mediawiki
    spot:~ rdm$ chmod a+w config
    

  • Fill in the fields, making appropriate notes, and submit the form.

  • Move config/LocalSettings.php to the parent directory and tighten up its settings:
    spot:~ rdm$ mv config/LocalSettings.php .
    spot:~ rdm$ sudo chmod 664 LocalSettings.php
    

For more information, see:

Semantic MediaWiki

  • Under semediawiki > semediawiki-1.4.3, click on semediawiki-1.4.3.tar.gz.

  • Move the compressed tar archive to the MediaWiki folder.

  • Double-click on the compressed tar archive (semediawiki-1.4.3.tar.gz).

  • There should now be a SemanticMediaWiki folder.

  • Remove the compressed tar archive (semediawiki-1.4.3.tar.gz).

Halo Extension (aka SMW+)

  • Click the "smwhalo" link in the "Job" column.

  • Click "last successful build" link, under "Permalinks".

  • Click the "smwhalo-1.4.5.zip" link, under "Build Artifacts".

  • Move the compressed tar archive to the MediaWiki folder.

  • Double-click on the Zip archive (eg, smwhalo-1.4.5.zip).

  • There should now be a smwhalo-1.4.5 folder.

  • Remove the Zip archive (eg, smwhalo-1.4.5.zip).

Configuration

Assuming that the packages are on your system, you now have the task of configuring and testing them. Because SMW+ is basically a stack of software, we'll configure and test each level in turn.

Apache


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r7 - 30 Oct 2009, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email