Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How To Install and Configure the Questions and Answers Framework on CentOS 7  (Read 1309 times)

0 Members and 1 Guest are viewing this topic.

jibinw

  • Guest
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.
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:

Code: [Select]
# yum group install 'Development Tools'
Next, install EPEL repository:

Code: [Select]
# yum install epel-release
Last dependencies are those related to Python. In particular, we will use pip to install Askbot:

Code: [Select]
# 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:

Code: [Select]
# yum -y install postgresql-server postgresql-devel postgresql-contrib
Code: [Select]
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:

Code: [Select]
#systemctl start postgresql
#systemctl start postgresql
Login as postgres user and access the psql command line tool:
Code: [Select]
$ su - postgres
$ psql

Create a Database For Askbot

Create a new database and user for Askbot, with the following PostgreSQL queries:
Code: [Select]
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:
Code: [Select]
# $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
Code: [Select]
# 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:
Code: [Select]
# systemctl restart postgresql
Code: [Select]
Install and Configure Askbot
At this point, it is possible to install Askbot. First of all, create a new user, named askbot:
Code: [Select]
# useradd -m -s /bin/bash askbot
# passwd askbot

Next, add this new user to the wheel group:
Code: [Select]
# usermod -a -G wheel askbot
Upgrade pip to the latest version:

Code: [Select]
# pip install --upgrade pip
Next, install the virtualenv package:

Code: [Select]
# pip install virtualenv six
Log in as the askbot user previously created, and create a new virtual environment with virtualenv:
Code: [Select]
$ su - askbot
$ virtualenv unixmen/

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

Code: [Select]
$ source unixmen/bin/activate
Next, install Askbot and other required packages with pip:

Code: [Select]
$ 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.:
Code: [Select]
$ mkdir testing
Initialize a new Askbot project by executing the following commands:

Code: [Select]
$ 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:

Code: [Select]
$ python manage.py collectstatic
Generate the database:

Code: [Select]
$ python manage.py syncdb
So, Askbot has been installed and the testing project configured. Test it with runserver:

Code: [Select]
$ 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, I have explained 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.