Askbot: How To Install and Configure the Questions and Answers Framework on CentOS 7

askbot

Introduction

Askbot is an open source Question and Answer (Q&A) forum project. It is inspired by StackOverflow and Yahoo Answers.
Askbot is written in Python on top of the Django framework.

  • Efficient question and answer knowledge management
  • Focused on-topic discussions
  • Best answers are shown first
  • Tag and categorize
  • Follow-up in the comments
  • Organize comments and answers by re-posting
  • Everything is editable
  • Users are rewarded with karma for posting useful information
  • Upvotes grow users karma and the downvotes decrease it
  • Votes identify best content, while karma spotlights and rewards experts
  • User privileges grow along with their reputation.
  • Choose either public, private or hidden karma.
  • When new posts are made users can receive notifications

Askbot is being used by Fedora and Shazam Community, among the others.

In this tutorial we will see how to install and configure Askbot on a CentOS 7 Server.

Dependencies Installation

First of all, install packages required by Askbot. On CentOS, these are the “Development Tool” group, EPEL and Python packages.

Install the “Development Tool” group by executing the following yum command:

# yum group install 'Development Tools'

Next, install EPEL repository:

# yum install epel-release

Last dependencies are those related to Python. In particular, we will use pip to install Askbot:

# yum install python-pip python-devel python-six

Install PostgreSQL

Askbot uses PostgreSQL as database system to store its data. PostgreSQL is available in CentOS 7 repositories, so install it executing the following command:

# yum -y install postgresql-server postgresql-devel postgresql-contrib

Once the installation is complete, initialize the database with the following command:

$ postgresql-setup initdb

Next, start PostgreSQL and enable it to start at boot time:

#systemctl start postgresql
#systemctl start postgresql

Login as postgres user and access the psql command line tool:

$ su - postgres
$ psql

Create a Database For Askbot

Create a new database and user for Askbot, with the following PostgreSQL queries:

postgres=# create database askbotdb;
postgres=# create user askbotusr with password 'usr_strong_pwd';
postgres=# grant all privileges on database askbotdb to askbotusr;

Configure PostgreSQL

Edit PostgreSQL configuration file for authentication setup, which is /var/lib/pgsql/data/pg_hba.conf:

# $EDITOR /var/lib/pgsql/data/pg_hba.conf

Change all authentication to mIn this tutorial we will see how to install and configure Askbot on a CentOS 7 Server.d5:

local all all md5
 # IPv4 local connections:
 host all all 127.0.0.1/32 md5
 # IPv6 local connections:
 host all all ::1/128 md5

Save, close the file and restart PostgreSQL:

# systemctl restart postgresql

Install and Configure Askbot

At this point, it is possible to install Askbot. First of all, create a new user, named askbot:

# useradd -m -s /bin/bash askbot
# passwd askbot

Next, add this new user to the wheel group:

# usermod -a -G wheel askbot

Upgrade pip to the latest version:

# pip install --upgrade pip

Next, install the virtualenv package:

# pip install virtualenv six

Log in as the askbot user previously created, and create a new virtual environment with virtualenv:

$ su - askbot
$ virtualenv unixmen/

Activate this new virtual environment, by executing the following command:

$ source unixmen/bin/activate

Next, install Askbot and other required packages with pip:

$ pip install six askbot psycopg2

Testing Askbot

Last step is to test the Askbot installation. Create a new directory, being sure to not use “askbot” as its name.:

$ mkdir testing

Initialize a new Askbot project by executing the following commands:

$ cd testing
$ askbot-setup

During this process, Askbot will ask for some information required to create the project, for example those related to the database created with PostgreSQL.

At the end, generate the Django static files with the following python command:

$ python manage.py collectstatic

Generate the database:

$ python manage.py syncdb

So, Askbot has been installed and the testing project configured. Test it with runserver:

$ python manage.py runserver 0.0.0.0:8080

With a web browser, go to the server IP address, and you should see a forum page.

Conclusion

In this tutorial we have seen how to install and configure Askbot on a server powered by CentOS 7. Of course, this is just the first step in the realization of a full Q&A website.