This is a static copy of the main wikispot.org site, preserved for historical purposes only. Please see this page for more information.

Installing on Dreamhost

InfoInfo
Search:    

    1. About this Guide
    2. Assumptions and Overview
    3. Install Python
    4. Install MySQL-Python
    5. Install Python Imaging Library
    6. Install Xapian (optional)
      1. Install xapian-core
      2. Install xapian-bindings
      3. Enable Xapian in Sycamore
    7. Install Sycamore
      1. Create the Database
      2. Download Sycamore
      3. Configure Sycamore
        1. Install in the Web Root
        2. Install in a Subdirectory
      4. Fix Python Location
      5. Populate the Database
      6. Configure mod_rewrite
      7. Enable Internet Access
        1. Install in the Web Root
        2. Install in a Subdirectory
      8. Enabling FastCGI (optional)
    8. Credits

About this Guide

Installing and configuring Sycamore on a [WWW]Dreamhost Shared Hosting Plan is rather involved because Dreamhost does not offer some of the libraries that Sycamore requires.

This how-to will outline step-by-step instructions on installing and configuring Sycamore to run on a Dreamhost Shared Hosting Plan.

Assumptions and Overview

The following is an outline of the installation process.

  1. Download, compile, and install [WWW]Python 2.4

  2. Download, compile, and install [WWW]MySQL Python bindings

  3. Download, compile, and install [WWW]Python Imaging Library

  4. Create a new MySQL user and database for Sycamore data

  5. Download, configure, install, and test [WWW]Sycamore

  6. Download, compile, and install [WWW]Xapian Core and Bindings (optional)

Install Python

Dreamhost comes with both Python 2.3 and 2.4. If you wish you might be able to skip this step and just refer to python2.4 everywhere but you might have problems when it comes time to install some of the packages. This how-to includes instructions on building the latest python from source.

Connect to your account using SSH and create a temporary directory called build that you will use for building the various software packages.

$ mkdir ~/build
$ cd ~/build

Download the latest release of [WWW]Python 2.4 and unpack the compressed archive.

$ wget http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tgz
$ tar zxf Python-2.4.4.tgz
$ cd Python-2.4.4

Configure python to install in your home directory. This will put the python binaries in ~/bin and the libraries in ~/lib.

$ ./configure --prefix=$HOME --enable-unicode=ucs4
$ make
$ make install

Add and test the newly created bin directory to your environment search path. You can also do this by putting the first line in the ~/.bash_profile file.

$ export PATH=~/bin:$PATH
$ which python
/home/{USERNAME}/bin/python
$

Install MySQL-Python

[WWW]MySQL Python is a python library that allows python programs to connect to and use a MySQL database. Sycamore requires this library if it is configured to use a MySQL database. Since Dreamhost only offers MySQL this package is required. These instructions will outline how to install the latest MySQL-Python in your home directory.

Note: There is a bug with MySQL-Python version 1.2.2 so do not use it!

Download the latest supported version of MySQL-Python and unpack the archive.

$ cd ~/build
$ wget http://easynews.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.1_p2.tar.gz
$ tar zxf MySQL-python-1.2.1_p2.tar.gz
$ cd MySQL-python-1.2.1_p2

Download setuptools (this is for egg support in more recent package versions).

$ wget http://cheeseshop.python.org/packages/2.4/s/setuptools/setuptools-0.6c5-py2.4.egg
$ chmod +x setuptools*
$ ./setuptools*

Alternate method to get setuptools (this will get the right version based on whatever python version you have)

$ wget http://peak.telecommunity.com/dist/ez_setup.py
$ python ez_setup.py

Build and install MySQL-Python. This will install the libraries into the ~/lib/python2.4/site-packages directory.

$ python setup.py build
$ python setup.py install

Install Python Imaging Library

The [WWW]Python Imaging Library allows Sycamore to manipulate images in various ways including resizing them. These instructions will install the PIL into your ~/lib/python2.4/site-packages directory.

Download and unpack the latest version of PIL.

$ cd ~/build
$ wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz
$ tar zxf Imaging-1.1.6.tar.gz

Build, test, and install PIL. This will install the libraries into the ~/lib/python2.4/site-packages directory.

$ cd Imaging-1.1.6
$ python setup.py build_ext -i
$ python selftest.py
57 tests passed.
$ python setup.py install

Install Xapian (optional)

Sycamore can use the [WWW]Xapian Open Source Search Engine Library to speed up search on the wiki. Xapian does not need root access to install and can be installed into your home directory. This is a small step for a large performance boost. It is highly recommended. You might have problems enabling this feature after the site is already installed.

Install xapian-core

Download and unpack the latest [WWW]xapian-core library.

$ cd ~/build
$ wget http://www.oligarchy.co.uk/xapian/0.9.10/xapian-core-0.9.10.tar.gz
$ tar zxf xapian-core-0.9.10.tar.gz

Configure, build, and install the libraries in your home directory. This will install binaries in ~/bin and libraries in ~/lib.

$ cd xapian-core-0.9.10
$ ./configure --prefix=$HOME
$ make
$ make install

Install xapian-bindings

Download and unpack the latest [WWW]xapian-bindings library.

$ cd ~/build
$ wget http://www.oligarchy.co.uk/xapian/0.9.10/xapian-bindings-0.9.10.tar.gz
$ tar zxf xapian-bindings-0.9.10.tar.gz

Configure, build, and install the library in your home directory. This will install only the python xapian bindings.

$ cd xapian-bindings-0.9.10
$ ./configure --without-php --without-ruby --without-java --without-csharp --without-tcl --with-python --prefix=$HOME XAPIAN_CONFIG=$HOME/bin/xapian-config
$ make
$ make install

Enable Xapian in Sycamore

Now that xapian-core and the python xapian-bindings are installed you can enable the xapian option in Sycamore. Edit the share/sycamore_config.py configuration file and enable has_xapian

has_xapian = True

Install Sycamore

Once you have completed each of the above steps you are ready to run Sycamore.

Create the Database

Although Sycamore can be configured to use either MySQL or Postgres Dreamhost currently only offers MySQL databases so this guide assumes that MySQL will be used.

First you need to log into the [WWW]Dreamhost Panel and navigate to [WWW]Goodies > Manage MySQL

If you do not have a database host you need to add one. Click on Add Hostname and follow the directions. A good convention is to use db.domain.org*.

Then you need to create a new database. Go down to Create a New MySQL Database, enter in the database name sycamore* and select the hostname.

Then you need to create a new database user. Select an existing user or select Create a new User. Set the username to user*, password to password*.

* These are example values that should be changed when you install Sycamore. These default values will be used later and you should replace them with what you used in this step. It might help to write them down temporarily.

Download Sycamore

You need to grab the latest release of Sycamore. This is currently done by checking out the code from the source code repository.

$ mkdir ~/src
$ svn co http://svn.devjavu.com/sycamore/trunk ~/src/sycamore
$ cd ~/src/sycamore

This will place all the Sycamore source code files in to a directory named ~/src/sycamore.

Configure Sycamore

The main configuration file for Sycamore is located at share/sycamore_config.py. You need to modify a few variables for your environment. Find the following sections and replace them with the correct values.

For the database related options be sure to use the same values that you used when creating the database.

db_type = 'mysql'  # can be 'mysql' or 'postgres'
db_name = 'sycamore'
db_user = 'user'
db_user_password = 'password'
db_host = 'db.domain.org'

Directory locations are dependent on your username and your domain name. It might help to use full paths here.

data_dir = '/home/USERNAME/src/sycamore/share/data'
web_root = '/home/USERNAME/domain.org'
domain = 'domain.org'

The web_dir depends on where you want your wiki to be installed. Some people want their wiki to be the entire website and others want it to be a in a subdirectory off of the main website. The relative_dir option is currently a mystery. Just make it match what web_dir is set to but without the leading slash.

The URL prefix option is for certain static files used in themes and icons. This directory is normally called wiki. The following example is for the subdirectory configuration.

url_prefix = '/sycwiki/wiki'

Email addresses should be changed to one that you manage.

mail_from = 'webmaster@domain.org'
paypal_address = 'donate@domain.org'

Install in the Web Root

If you want Sycamore to be in the root directory of your website (so [WWW]http://domain.org/ loads Sycamore) then configure as follows.

web_dir = ''
relative_dir = ''
Install in a Subdirectory

If you want your wiki installed to a subdirectory called sycwiki just configure as follows:

web_dir = '/sycwiki'
relative_dir = 'sycwiki'

Fix Python Location

There is only one place where you need to fix the location of python. Since we installed our own python you need to tell the initial script where to find that binary.

The file you need to update is in all files in share/web in the Sycamore code. Change the first line to read (replace USERNAME with your username):

#!/home/USERNAME/bin/python -OO

Then add the following replacing USERNAME with your username:

sys.path.insert(0,'/home/USERNAME/src/sycamore')

Populate the Database

Now run the builddb.py script and check the output for any errors. If you see any errors here you will probably not have a complete wiki site.

$ cd ~/src/sycamore
$ python Sycamore/builddb.py
creating tables..
tables created
creating views...
views created
creating other stuff...
other stuff created
inserting basic pages...
You don't have Xapian installed...skipping configuration of search index.
Building page caches...
  --> Bookmarks
  --> Front Page
  --> Help
  --> Help/Help with Editing
  --> Help/Help with Formatting
  --> Help/Help with Headlines
  --> Help/Help with Images
  --> Help/Help with Linking
  --> Help/Help with Lists
  --> Help/Help with Macros
  --> Help/Help with Tables
  --> Orphaned Pages
  --> Outgoing Links
  --> Recent Changes
  --> Sandbox
  --> System Pages Group
  --> Title Index
  --> User Preferences
  --> User Statistics
  --> Users
  --> Wanted Pages
  --> Wiki Settings
  --> Wiki Settings/CSS
  --> Wiki Settings/Images
XXXXXXXXXXXXXXXXXXXXXXXXXXX
rebuilt page caches!
XXXXXXXXXXXXXXXXXXXXXXXXXXX
$

Configure mod_rewrite

To handle the Wiki's URLs create an .htaccess file and place the following rules. These rules prevent actual files and directories (like the ones for various themes) from being rewritten. It also forces all other URLs to be handled by the index.cgi python script.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !index.cgi
RewriteRule ^(.*)$ index.cgi/$1 [L]

Enable Internet Access

Now that everything is installed on the file system you need to allow the code to be called from the internet. There are a couple ways you can do this but essentially you need a copy of index.cgi and all the theme files in the directory you've configured it to be in.

Install in the Web Root

If you configured Sycamore to be installed in the web root install it in ~/domain.org.

$ cd ~/domain.org
$ cp -p ../src/sycamore/share/web/index.cgi .
$ cp -rp ../src/sycamore/share/web/wiki .
Install in a Subdirectory

If you've configured it to be in a subdirectory called sycwiki you should create a link called sycwiki pointing to $HOME/src/sycamore/share/web like so:

$ cd ~/domain.org
$ ln -s ../src/sycamore/share/web sycwiki

Enabling FastCGI (optional)

This step is optional but highly recommended. Dreamhost supports both CGI and FastCGI (using Apache mod_fastcgi). The instructions above outline running Sycamore using CGI. Using FastCGI with Sycamore will provide page load improvement.

You will need to [WWW]enable FastCGI for your account via the [WWW]Panel.

Next, rename index.fcgi to dispatch.fcgi as dreamhost monitors and kills off zombie processes that fork from anything other than dispatch.fcgi and cause HTTP 500 Internal Server Errors. More on that [WWW]here and [WWW]here

You must also modify the .htaccess file to point to dispatch.fcgi instead of index.cgi.

To start the FastCGI process, navigate to you wiki root ~/domain.org/path/to/wiki/installation and execute ./dispatch.fcgi at the shell prompt.

Credits

This guide was initially created by AdamDewitz in late 2006. It was updated by [sacramento]Sc0ttBeardsley in May 2007. And again by PaulIvanov in May 2008.

Any Questions?

Note: You must be logged in to add comments



2007-09-14 19:53:33   I'm having issues accomplishing an install on a Dreamhost account. I'm installing because I'm trying to learn, so I'm not really sure where I should be looking. I get the following error.

request.print_exception handler
Traceback (most recent call last):

AttributeError: 'NoneType' object has no attribute 'endswith'

Apparently it has something to do with modpy.py, from what google tells me. I'm not sure if I screwed something up, or if this guide might not work anymore, or something else.


2008-05-21 17:51:16   I am looking to move from my current hosting provider [WWW]http://phpwebhosting.com to a new company as I've outgrown them. I also want to install sycamore for commercial purposes, hence I can't simply use wikispot.org as they are geared to non-profit wikis. Has anyone recently attempted and succeeded in getting recent version of sycamore running on Dreamhost or any other shared hosting provider out there. Right now, Getting sycamore to run is my single determining factor in choosing a new webhost. Thanks in advance to anyone who shares their experience/insights. —HimySyed


2008-05-26 00:14:45   yes, HimySyed - about a month ago I installed and now run sycamore trunk on dreamhost. Beware that dreamhost has some special-stuff you need to do to run python and fastCGI (check their wiki) —PaulIvanov

This is a Wiki Spot wiki. Wiki Spot is a 501(c)3 non-profit organization that helps communities collaborate via wikis.