Moving on, start postgres and enable it to launch automatically at the boot time.

1

2

systemctl start postgresql

systemctl enable postgresql

At this point, the PostgreSQL database should be installed. Next, we need to reset the postgres user password. For this, first login as ‘postgres’ user and access the psql command line tool.

1

2

su-postgres

psql

And then give the postgres user a new password.

1

\password postgres

Now, create a new database and user for Askbot. For example, we want to create a new user ‘hakaselabs‘ with password ‘hakase123‘, and the database named ‘askbotdb‘. The following postgres queries will help us create all of these.

1

2

3

create database askbotdb;

create user hakaselabs with password'hakase123';

grant all privileges on database askbotdb tohakaselabs;

So now, a database and user for Askbot installation have been created. 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 vim.

Once inside the file, change all authentication to md5, as shown below.

1

2

3

4

5

localallallmd5

# IPv4 local connections:

hostallall127.0.0.1/32md5

# IPv6 local connections:

hostallall::1/128md5

Now, save and exit the file, and then restart the postgres service.

1

systemctl restart postgresql

So by now, the PostgreSQL database has been installed; database for the Askbot installation has been created; and the postgres user authentication method has been changed to md5.

Step 3 – Install and configure Askbot

In this step, we will discuss the installation and configuration of Askbot. We will install Askbot under a user named ‘askbot’, and using the virtualenv python. So let’s begin.

Firstly, create a new user ‘askbot’ and give the user a new password.

1

2

useradd-m-s/bin/bash askbot

passwd askbot

Then add the ‘askbot’ user to the ‘wheel’ group for sudo command access (not sure what ‘sudo’ is? Learn more about it here).

1

usermod-a-Gwheel askbot

Now upgrade pip to the latest version and install the python virtualenv package.

1

2

pip install--upgrade pip

pip install virtualenv six

Next. log in as ‘askbot’ user and create new python virtual environment ‘hakase-labs’ with virtualenv.

1

2

su-askbot

virtualenv hakase-labs/

Go to the ‘hakase-labs’ directory and activate the virtual environment for Askbot installation.

1

2

cd hakase-labs/

source bin/activate

Now install askbot and other python packages with pip command on ‘hakase-labs’ virtual environment.

1

2

pip install six

pip install askbot psycopg2

Next, create a new directory for the ‘Askbot’ project. Please make sure you don’t use ‘askbot’ as the directory name. In our case, for example, we created a new directory named ‘myapp’

1

mkdir myapp/

Go to the myapp directory and run the ‘askbot-setup’ command.

1

2

cd myapp/

askbot-setup

The ‘askbot-setup’ command will ask you certain things. For example, you will be asked about directory path to deploy Askbot – you can type ‘.’ and press Enter to continue. Similarly, when asked about database engine, type ‘1’ to use postgresql and press Enter. For database-related details, enter databasename as ‘askbotdb’, database user as ‘hakaselabs’, and password as ‘hakase123’.