In this tutorial, we will show you how to install Askbot on your CentOS 7. For those of you who didn’t know, Askbot is a question-and-answer web forum and it looks like StackOverflow Q&A web forums. It is based on the Django web framework and written in the Python programming language. It is an open-source Q&A web forum project maintained and developed by Evgeny Fadeev. Some most popular open-source projects like Ask-Fedora and Ask-LibreOffice use AskBot to provide support for their users and clients.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Askbot on a CentOS 7 server.
Prerequisites
- A server running one of the following operating systems: CentOS 7.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Askbot on CentOS 7
Step 1. First, let’s start by ensuring your system is up-to-date.
yum clean all yum -y update
Step 2. Installing Dependencies Askbot.
Install the required packages:
yum group install 'Development Tools' yum install epel-release yum install python-pip python-devel python-six
Step 3. Installing PostgreSQL.
Askbot uses PostgreSQL as a database system to store its data, so install it by executing the following command:
yum install postgresql-server postgresql-devel postgresql-contrib
Start Postgres and enable it to launch automatically at the boot time:
postgresql-setup initdb systemctl start postgresql systemctl start postgresql
Step 4. Create Database For Askbot.
First of all, we will create a database tech brown for the AskBot project:
postgres=# create database askbotdb; postgres=# create user askbotusr with password 'usr_strong_passwd'; postgres=# grant all privileges on database askbotdb to askbotusr;
The next step is to edit the Postgres configuration for authentication setup, which you can do by heading to the 'pgsql/data'
directory and editing the ‘pg_hba.conf’ file with nano:
nano /var/lib/pgsql/data/pg_hba.conf
Once inside the file, change all authentication to md5, as shown below:
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
Step 5. Installing Askbot.
We will install Askbot under a user named ‘Askbot’, and use the virtualenv python. So let’s begin:
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 idroot/
Activate this new virtual environment, by executing the following command:
source idroot/bin/activate
Next, install Askbot and other required packages with pip:
pip install six askbot psycopg2
Next, create a new directory for the ‘Askbot’ project. Please make sure you don’t use ‘Askbot’ as the directory name:
mkdir testing
Initialize a new Askbot project by executing the following commands:
cd testing askbot-setup
So Askbot is now installed on the ‘testing directory. Now we need to generate Askbot files and the database. Run the command below to generate Askbot Django static files:
python manage.py collectstatic
Generate the database:
python manage.py syncdb
So, Askbot has been installed and the testing project configured. Test it with the run server:
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.
Congratulations! You have successfully installed Askbot. Thanks for using this tutorial for installing Askbot on your CentOS 7 system. For additional help or useful information, we recommend you check the official Askbot website.