OSQA is questions and answers application built in Django. It’s open source StackOverflow clone.
While it has documentation about installing on Linux server, but here I just want to share my step to step instructions on installing OSQA in Ubuntu server.
Web Server
Install apache webserver and mod_wsgi module
sudo apt-get install apache2 libapache2-mod-wsgi
Database Server
Install mysql server.
sudo apt-get install mysql-server mysql-client
Create new user with the password ‘osqa12′ (you can change whatever you like), create new database and grant the database access to the user
CREATE USER 'osqa'@'localhost' IDENTIFIED BY 'osqa12'; CREATE DATABASE osqa DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci; GRANT ALL ON osqa.* to 'osqa'@'localhost';
Ubuntu tools and libraries
This libraries and tools need to be installed in Ubuntu.
sudo apt-get install build-essential libmysqlclient15-dev python-dev python-setuptools sudo easy_install pip
Installing OSQA
-
Before installing OSQA, please make sure you are in the directory where you want to put the application. For this tutorial we’ll have OSQA install into /home/qa
cd /home/qa
- Download OSQA
wget -c http://www.osqa.net/releases/fantasy-island-0.9.0-beta3.tar.gz
- Extract OSQA
tar -xvf fantasy-island-0.9.0-beta3.tar.gz
- Install requirement
sudo pip install mysql-python markdown html5lib south python-openid django
- Rename local settings, and update your database credential and APP_URL
mv settings_local.py.dist settings_local.pySample configuration for domain qa.com.
DATABASE_NAME = 'osqa' DATABASE_USER = 'osqa' DATABASE_PASSWORD = 'osqa12' DATABASE_ENGINE = 'mysql' APP_URL = 'http://qa.com'
-
Change manage.py into executable for shortcut
chmod +x manage.py - Create all database structure, and answer no for create super user
./manage.py syncdb --all
- Create fake migration for better update in the future
./manage.py migrate forum --fake
Running OSQA in WSGI mode
- Rename osqa.wsgi.dist and update the content
mv osqa.wsgi.dist osqa.wsgi vim osqa
Sample configuration :
import os import sys sys.path.append('/home/qa') sys.path.append('/home/qa/osqa') # The first part of this module name should be identical to the directory name # of the OSQA source. For instance, if the full path to OSQA is # /home/osqa/osqa-server, then the DJANGO_SETTINGS_MODULE should have a value # of 'osqa-server.settings'. os.environ['DJANGO_SETTINGS_MODULE'] = 'osqa.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
-
create or edit virtual host for apache :
vim /etc/apache2/sites-available/qa.com.conf<VirtualHost 75.102.27.243:80> SuexecUserGroup "#1000" "#1000" ServerName qa.com ServerAlias www.qa.com LogLevel info WSGIDaemonProcess qa.com display-name=%{GROUP} WSGIProcessGroup qa.com WSGIScriptAlias / /home/qa/osqa/osqa.wsgi Alias /m/ "/home/qa/osqa/forum/skins/" <Directory "/home/qa/osqa/forum/skins"> Order allow,deny Allow from all </Directory> Alias /upfiles/ "/home/qa/osqa/forum/upfiles/" <Directory "/home/qa/osqa/forum/upfiles"> Order deny,allow Allow from all </Directory> ErrorLog /var/log/qa.com_error_log CustomLog /var/log/qa.com_access_log combined ServerSignature On </VirtualHost>
- Copy the configuration into /etc/apache2/sites-enabled/
sudo ln -s /etc/apache2/sites-available/qa.conf /etc/apache2/sites-enabled/qa.conf
-
Restart apache
sudo /etc/init.d/apache restart
Related posts:
[...] http://komunitasweb.com/2011/06/how-to-install-osqa-in-ubuntu-server/ [...]