In this article, we will have explained the necessary steps to install and configure Askbot on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo
privileges. All the commands in this tutorial should be run as a non-root user.
Askbot is an open-source question and answer (Q&A) software for creating a Q&A forum that is built on Python and Django Framework. It is simple, highly customizable, and very similar to other forum software including StackOverflow and YahooAnswers. It has some good features including a karma-based content system, voting, and content moderation.
Install Askbot on Ubuntu 20.04
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade sudo apt install python-dev python-setuptools python3-pip python3-psycopg2 libpq-dev
Step 2. Install PostgreSQL Database Server.
For a database server, we’ll use a PostgreSQL database server. This can be installed with the commands below:
sudo apt install postgresql postgresql-client
Once done, 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 User Password.
It is a good idea to create or change the default Postgres user password:
sudo passwd postgres
When prompted, create a new Linux password for Postgres users as shown below:
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Step 4. Create the PostgreSQL database.
We are going to type the following to create a new database called askbot:
su - postgres psql create database askbot; create user askbotuser with password 'your-strong-password-here'; grant all privileges on database askbot to askbotuser; \q exit
After creating the above database and user, let’s edit the PostgreSQL configuration file and enable md5 authentication. We can do this with our favorite editor:
sudo nano /etc/postgresql/12/main/pg_hba.conf
Edit the highlighted lines to reference md5 authentication:
"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
After editing the above file, we save and exit. Now we will have to restart PostgreSQL:
sudo systemctl restart postgresql
Step 5. Install Askbot on the Ubuntu system.
First, create a new user named askbot and create new password for that user account:
sudo useradd -m -s /bin/bash askbot sudo passwd askbot sudo usermod -a -G sudo askbot
Next, we are going to execute this other command in the terminal to install Python virtual environment (virtualenv):
sudo pip install virtualenv six
Then, log in to the askbot user account using the su
commands and create a new virtual environment for Askbot:
su - askbot virtualenv askbot
The next step will be to switch to the virtual environment and activate 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
we will create a directory called myapps for askbot and configure it:
mkdir myapps cd myapps
And setup Askbot using the command:
askbot-setup
Output:
Deploying Askbot - Django Q&A forum application Problems installing? -> please email [email protected] 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) > [email protected] Enter name of the site admin (required) > superadmin Enter the default from email Press ENTER to use [email protected] > Enter the server email Press ENTER to use [email protected]
Finally, run the command below to complete the setup:
cd askbot_site/ python manage.py collectstatic python manage.py migrate
Step 6. Launch Askbot.
You can start or test the Askbot application by running the command below:
python manage.py runserver --insecure 0.0.0.0:8080
To access your Askbot application via the URL, open your favorite web browser and browse the server IP with port 8080:
http://localhost:8080
That’s all you need to do to install the Askbot on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on Install Askbot, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.