How to install OSQA

Posted on November 24, 2016
python, django, maygodhavemercy, ubuntu

Nobody should install this. There’s a fork called askbot that can just be installed using pip.

OSQA is “The Open Source Q&A System”. The official download link goes to a github repo with the last commit in February of 2015.

Should you want to install this? No. But if you have to install this, buckle up and get ready for the ride.

This is for Ubuntu 16.04. Deviating from this guide will land you in the curb, with bruises. Notably, OSQA will not work. Yes, I use pip to install things globally. If you want to use a virtualenv be my guest but don’t forget to enable --system-site-packages. Oh and you will need to use pip to install virtualenv for python 2.

Basic installation

Install some dependencies and create a user:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install python-pip git libmysqlclient-dev mysql-server
# sudo pip install virtualenv # optional
sudo adduser --home /var/www/osqa osqa --disabled-password

Setup MySQL:

sudo mysql_secure_installation
mysql -u root -p
\> create database osqa DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
\> CREATE USER 'osqa'@'localhost' IDENTIFIED BY 'the_password';
\> GRANT ALL PRIVILEGES ON osqa . * TO 'osqa'@'localhost';
\> FLUSH PRIVILEGES;
\> quit

Setup OSQA (See below for what to fix up in settings_local.py):

sudo -u osqa -i
git clone https://github.com/dzone/osqa.git
# virtualenv osqa_env --system-site-packages # optional, but obviously remove the
# . ./osqa_env/bin/activate                  # "sudo" from the pip install hereafter
sudo pip install Markdown==2.4.1
sudo pip install mysql-python
cd osqa
sudo pip install -r requirements.txt
cp settings_local.py{.dist,}
vim settings.py                             # Change the SECRET_KEY

Settings you should change in settings_local.py:

Setup Django:

python manage.py syncdb --all           # Don't set up a superuser. Or do. I'm not the police.
python manage.py migrate forum --fake
python manage.py runserver 0.0.0.0:8080

WSGI

sudo apt-get install apache2 libapache2-mod-wsgi

Then make up a site config and adjust the wsgi runner in the osqa dir. (TBD)