Categories: TutorialsUbuntu

How to Install Askbot on Ubuntu 18.04 | 20.04

In this article, we are going to shows how to install Askbot on Ubuntu 20.04 | 18.04. If you are interested to install Askbot on Ubuntu then this post is ideal for you.

Askbot is an open source question and answer (Q&A) software for creating Q&A forum that is built on Python and Django Framework. With the help it, you can easily setup your own Q&A platform similar to StackOverflow and Yahoo Answers.


It was developed by Mike Chan and Sailing Cai in 2009, and it is easy to install and configure on Linux systems including Ubuntu. It is also comes with some good features like a karma-based system, user control with reward systems, voting, best answers being shown first, content moderation and categorized by tags.


Sponsored
class="wp-block-separator is-style-wide">

How to Install Askbot on Ubuntu

Simply follow below steps to install Askbot question and answer platform on Ubuntu:

Step 1 : Install Required Dependencies

To install Askbot, first you will need to install python packages and pip package manager by running command below:

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




Step 2 : Install PostgreSQL Database Server

Askbot support many database servers like MySQL, SQLite, and PostreSQL. For this tutorial we will install PostgreSQL Database Server. To install it, run the command below:

sudo apt install postgresql postgresql-client

After installing, you can use the commands below to stop, start, enable and check PostgreSQL status:

sudo systemctl stop postgresql.service
sudo systemctl start postgresql.service
sudo systemctl enable postgresql.service
sudo systemctl status postgresql.service

Step 3 : Create PostgreSQL Linux User Password

If you want create or change the default PostgreSQL user password then run the commands below to create or change the user password in the bash shell and not in the PostgreSQL interactive shell:

sudo passwd postgres

When prompted, create a new Linux password for postgres user as show below:



Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully



After that, when you will try to access PostgreSQL interactive shell, every time you will be ask to confirm the password that you created above.


Step 4 : Create PostgreSQL database

To create PostgreSQL database, first connect to its shell console by running command below. During connecting, you will be prompted to enter the password you created above.

su - postgres
psql

After connecting to its shell console, run the command below in the shell console to create a new database called askbot as how below:

create database askbot;

Next, run the command below to create a database user named askbotuser :

create user askbotuser with password 'your_new_password_here';

Grant the newly created database user full access to the database:

grant all privileges on database askbot to askbotuser;
q
exit

Next, you will need to edit PostgreSQL configuration file and enable md5 authentication. To to that, run the command below:



sudo nano /etc/postgresql/12/main/pg_hba.conf

After open the file, edit the highlighted lines to reference md5 authentication as show below:

"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
 Allow replication connections from localhost, by a user with the

Save the file and exit.

Now, run the command below to restart the PostgreSQL services :

sudo systemctl restart postgresql

Step 5 : Install and Configure Askbot

Before install askbot, you will need to create a new dedicated user account for Askbot installation. So simply create a new user named askbot and create new password for that user account:

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

Next, add the askbot user to the sudo group by running command below :

sudo usermod -a -G sudo askbot

After that, run the commands below to install Python virtualenv (virtual environment) package:



sudo pip install virtualenv six

Now, login to the askbot user account using the su commands and create a new virtual environment for Askbot:

su - askbot
virtualenv askbot

Switch to the askbot virtual environment directory and activate the it:

cd askbot
source bin/activate

Next, run the command below to install Askbot, Six, and PostgreSQL modules.

pip install --upgrade pip
pip install six==1.10.0
pip install askbot==0.11.1 psycopg2

After installing modules, create a directory for Askbot :

mkdir myapp
cd myapp

And setup Askbot using the command below:

askbot-setup

The command above will prompt to ask environment details. You can use the below guide to answer:

Deploying Askbot - Django Q&A forum application
Problems installing? -> please email support@askbot.com

To CANCEL - press Ctr-C.

Enter the Root directory path (relative or absolute).
This directory will contain the Django project's manage.py file.
Press ENTER to use ./askbot_site.
> 
Enter the Project directory name.
Will be a subdirectory within the Root for the settings.py, urls.py files.
Press ENTER to use askbot_site.
> 
Select the database engine: 1 - postgresql, 2 - sqlite, 3 - mysql, 4 - oracle.
Type 1/2/3/4, press ENTER to select sqlite
> 1
Enter the database host name
Press ENTER to use empty string (default value).
> 
Enter database name. (required)
> askbot
Enter database password. (required)
> type_password_here
Enter database user name. (required)
> askbotuser
Enter the database port
Press ENTER to use empty string (default value).
> 
Enter email of the site admin (required)
> admin@example.com
Enter name of the site admin (required)
> superadmin
Enter the default from email
Press ENTER to use admin@example.com.
>   
Enter the server email
Press ENTER to use admin@example.com.



Finally, run the command below to complete the setup:

cd askbot_site/
python manage.py collectstatic
python manage.py migrate

At this point, Askbot is installed on your system and ready to be used.

You can start or test the Askbot application by running the command below:

python manage.py runserver --insecure 0.0.0.0:8080

Step 6 : Access Askbot

To access your Askbot application via the URL, open your favorite web browser and browse the server IP with port 8080:

http://localhost:8080



Use the below URL to login as admin:

http://localhost:8080/admin

If you not able to login, run the command below to create a super admin account:

python manage.py createsuperuser

That’s all

If you face any error and issue in above steps , please use comment box below to report.

If our article helps you, please consider buying us a coffee

Thank you for your support.


The post How to Install Askbot on Ubuntu 18.04 | 20.04 appeared first on Linux Tutorial Hub.

Ubuntu Server Admin

Recent Posts

Ubuntu vs Debian: Linux Distributions Compared Deep Dive

Debian and Ubuntu are two popular Linux distributions. In this deep dive we will guide…

4 hours ago

How to Install Google Cloud BigQuery Python client library on Linux

In this article, we will see how to Install Google Cloud BigQuery Python client library…

2 days ago

Wallpaper Contest for Xfce 4.20 open for voting

Nov 15,2024 Wallpaper Contest for Xfce 4.20 open for voting The submission phase for the…

2 days ago

Canonical announces the first MicroCloud LTS release

MicroCloud 2.1.0 LTS is now available, expanding the number of Canonical infrastructure solutions with a…

3 days ago

Join Canonical in Paris at Dell Technologies Forum

Canonical is thrilled to be joining forces with Dell Technologies at the upcoming Dell Technologies…

4 days ago

Bringing automation to open source 5G software at Ubuntu Summit 2024

In today’s massive private mobile network (PMN) market, one of the most common approaches to…

5 days ago