How To Install Askbot on Ubuntu 20.04 LTS

Install Askbot on Ubuntu 20.04

In this tutorial, we will show you how to install Askbot on Ubuntu 20.04 LTS. For those of you who didn’t know, AskBot is an open-source question-and-answer forum written in Django and Python. It provides features similar to StackOverflow, including a karma-based system, voting, and content moderation. Currently, it is used by open-source projects like Fedora and LibreOffice.

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 through the step-by-step installation of the Askbot on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Install Askbot on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade
sudo apt install python-dev python-setuptools python-pip sudo python-psycopg2 libpq-dev

Step 2. Installing PostgreSQL.

Now install the PostgreSQL package using the apt command:

sudo apt install postgresql postgresql-client

By default, the PostgreSQL service is started automatically after the installation. You can confirm if it is running with the command:

systemctl status postgresql.service

Once installed, connect to the PostgreSQL shell with the following command:

su - postgres
[[email protected] ~]$ psql

Next, create a database and user for Askbot with the following command:

postgres=# create database askbot;
postgres=# create user askbot with password 'your-strong-password';
postgres=# grant all privileges on database askbot to askbot;
postgres=# \q

After that, edit the PostgreSQL main configuration file and enable the md5 authentication:

nano /etc/postgresql/11/main/pg_hba.conf

Add the following line:

# "local" is for Unix domain socket connections only
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 and close the file, then restart PostgreSQL to apply the changes:

sudo systemctl restart postgresql

Step 3. Installing Askbot on Ubuntu 20.04.

We need to create a new user for AskBot installation, as we will not be using root users for it. Create a new user named askbot and give that user a new password:

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

Next, add askbot user to sudo with the following command:

usermod -a -G sudo askbot

After that, install python virtualenv package with the following command:

pip install virtualenv six

Once installed, change the user to askbot and create a new virtual environment for Askbot with the following command:

su - askbot
virtualenv askbot

Next, change the directory to askbot and activate the virtual environment with the following command:

cd askbot
source bin/activate

Next, upgrade pip to the latest version using the command below:

pip install --upgrade pip

Next, install Askbot, Six, and PostgreSQL module with the following command:

pip install six==1.10.0
pip install askbot==0.10.3 psycopg2

Next, create a directory for your application:

mkdir myapp

Next, change the directory to myapp and setup the Askbot with the following command:

cd myapp
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 static files:

python manage.py collectstatic

Next, migrate the database with the following command:

python manage.py migrate

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

Step 4. Accessing Askbot Web Interface.

Once successfully installed, Now open your web browser and access the Askbot web UI using the URL http://your-ip-address. If everything is okay, you should get to its dashboard below:

Install Askbot on Ubuntu 20.04 LTS

Congratulations! You have successfully installed Askbot. Thanks for using this tutorial for installing the Askbot on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Askbot website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!