October 7, 2024, Monday, 280

Install OSQA on Snow Leopard

From NeoWiki

Revision as of 05:26, 6 December 2010 by Neo (Talk | contribs)
Jump to: navigation, search


Prerequisites

Python

We can use the built-in Python 2.6.1 in OS X 10.6.5 at /usr/bin/python, or we can use MacPorts to install the newest Python 2.6.6 at /opt/local/bin/python.

setuptools

Download from here and install it or just let MacPorts install the py-setuptools package at /opt/local/bin/.

Apache Web Server

Just use built-in setup, the 64-bit Apache 2.2.15 in OS X 10.6.5.

mod_wsgi

Which is not in the default setup of Snow Leopard. We can download the newest source version from here and compile and install it like this:

curl -o mod_wsgi.tgz http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
tar -xzf mod_wsgi-3.3.tar.gz
cd  mod_wsgi-3.3
./configure
make
sudo make install

These steps will compile mod_wsgi.so and install it into /usr/libexec/apache2.

Now edit your Apache config file /etc/apache2/httpd.conf, add this line to the bottom of the LoadModule list:

LoadModule wsgi_module libexec/apache2/mod_wsgi.so

Installation

Install Django and Other Packages

Make sure setuptools has been correctly installed and the easy_install can be access in your system path. Then run:

sudo easy_install django
sudo easy_install html5lib
sudo easy_install markdown
sudo easy_install python-openid
sudo easy_install south
sudo easy_install django-debug-toolbar
sudo easy_install mysql-python

Check Out Newest OSQA Source

Actually you can checkout it to anywhere you want, but I just put them in the Python site-packages folder, and prepare some folder privileges:

export OSQA_HOME=/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/osqa
sudo svn co http://svn.osqa.net/svnroot/osqa/trunk/ $OSQA_HOME

sudo mkdir $OSQA_HOME/cache
sudo chmod 777 $OSQA_HOME/tmp
sudo chmod 777 $OSQA_HOME/log
sudo chmod 777 $OSQA_HOME/cache

Prepare the Database

First using your favorite tool to setup the database for OSQA, for me it's CocoaMySQL (Sequel Pro is just a shame!).

  • Create a database with the name 'osqa';
  • Create a user with the name 'osqa' and whatever password you like;
  • Give all permissions of database 'osqa' to user 'osqa@localhost'.

Populate Initial Data

First we must config the OSQA to use the database we've just created:

cd $OSQA_HOME
cp settings_local.py.dist settings_local.py
mate settings_local.py

Find the database configuration part and change them like these lines:

DATABASE_NAME = 'osqa'
DATABASE_USER = 'osqa'
DATABASE_PASSWORD = 'your_password'
DATABASE_ENGINE = 'mysql'
DATABASE_HOST = '/var/mysql/mysql.sock'
DATABASE_PORT = 

If you are not using MySQL via mysql.sock file, you can change the DATABASE_HOST variable to match your setup.

Now populate initial data using the tool from OSQA:

cd $OSQA_HOME
python manage.py syncdb --all
python manage.py migrate forum --fake
Tools clipart.png Warning: You will be prompted to create a new "super user." You should promptly answer "NO". Once you get your site running, create a new user through the normal OSQA account creation process and that will be your super user.

The last line is for