Harga Domain .ID Termurah Hanya 199rb

Cara Install dan Konfigurasi Askbot dengan Nginx di CentOS 7

Askbot adalah perangkat lunak open source untuk membuat forum Q&A yangg mengggunakan Python Django Framework. Pada dasarnya sistem Q&A seperti StackOverflow, Yahoo Answers, dan lainnya. Dibuat oleh Mike Chan dan Sailing Cai pada tahun 2009, dan mudah untuk menginstal dan mengkonfigurasi pada sistem Linux seperti Ubuntu dan CentOS. Banyak proyek perangkat lunak open source besar seperti Fedora dan LibreOffice menggunakannya.

Dalam tutorial ini, kami akan menunjukkan cara menginstal aplikasi Askbot Python Django menggunakan uWSGI dan Nginx web server pada sistem CentOS 7. Sedangkan untuk database, kami akan menggunakan PostgreSQL untuk instalasi Askbot.

What we will do

  1. Install dependencies
  2. Install and configure PostgreSQL
  3. Install and configure Askbot
  4. Install and configure uWSGI
  5. Install and configure Nginx Webserver
  6. Test the setup

Prerequisites

  • CentOS 7 Server
  • Root privileges

Step 1 – Install dependencies

Pada langkah ini, kami akan menginstal beberapa paket yang diperlukan untuk instalasi Askbot. termasuk ‘Alat Pengembangan’, Epel repositori, dan beberapa alat yang berhubungan dengan python (untuk mengelola paket Python). Jadi, mari kita mulai.

Pertama, instal CentOS ‘Development Tools’ dengan perintah grup yum di bawah ini.

Kemudian install the Epel repository.

Terakhir install the python packages, termasuk python pip, python-devel and python six.

Installing python

Step 2 – Install and configure PostgreSQL

Sekarang kita membutuhkan database PostgreSQL, yang tersedia di repositori CentOS. Di bagian ini, kita akan membahas bagaimana Anda dapat menginstal database PostgreSQL, mengubah pengguna kata sandi postgres, membuat pengguna baru dan database untuk instalasi Askbot, dan akhirnya, mengubah konfigurasi otentikasi postgres.

Jadi mari kita mulai dengan menginstal PostgreSQL dari repositori menggunakan perintah yum di bawah ini.

Setelah installation is complete, kita perlu menginisialisasi database, yang dapat Anda lakukan dengan menggunakan perintah di bawah ini.

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

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.

And then give the postgres user a new password.

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.

Install PostgreSQL

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.

Baca Juga:  Membangun Web Server Centos 6 (LAMP)

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

Configure PostgreSQL

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

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.

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

Install AskBot

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

Install pip

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

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

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

installing askbot

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’

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

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’.

Baca Juga:  Cara Install Own VPN PPTP CentOS

configure the application

So Askbot is now installed on the ‘myapp’ directory. Now we need to generate Askbot Django static files and the database.

Run the command below to generate Askbot Django static files.

When asked for confirmation, type ‘yes’ and press Enter.

python manage.py

Now, to generate the database, run syncdb as below.

You will be asked about creating the admin user and password. So when asked, type the username, email, and password for admin configuration.

Create admin user

So by now, Askbot has been installed, static files have been generated, and the database configuration has been completed.

You can test the Askbot installation with runserver command below.

Open your Web browser and type the server IP address, and you should see a page similar to the following:

Result in web browser

Step 4 – Install and configure uWSGI

We will be using uWSGI as service for the Askbot Django project. Specifically, we will be using uWSGI with Nginx web server for the Askbot installation. So let’s begin.

Firstly, install uWSGI using the pip command, as shown below.

After the installation is complete, create a new directory for the uWSGI virtual host files. For example, in our case, we created ‘/etc/uwsgi/sites’.

Go to the newly-created directory and create new askbot uWSGI configuration with vim.

Paste the following configuration in the file.

That’s it. Save the file and exit from the editor.

Next, add new uWSGI service script file to the ‘/etc/systemd/system’ directory. Go to the directory and create the ‘uwsgi.service’ file with vim.

Baca Juga:  Cara mengaktifkan Quota Container OpenVZ

Paste the following uWSGI service configuration in the file.

Save and exit.

Now, reload systemd services and enable uWSGI to start automatically at the boot time.

Reload services

So with this, uWSGI has been installed, and you should see it running as a service.

Step 5 – Install and configure Nginx webserver

So, Askbot is now installed, and it’s running under uWSGI sock file ‘askbot.sock’. In this step, we will be using Nginx web server as a reverse proxy for uWSGI application ‘Askbot’.

To begin with, install Nginx with the yum command.

Now go to the Nginx ‘conf.d’ directory and create new virtual host file ‘askbot.conf’ with the vim editor.

install nginx

Paste the following Askbot Nginx configuration in the file.

Save the file and exit from the editor. Now, test the configuration to make sure there is no error.

Next, start Nginx and uWSGI services.

And enable them to start automatically at the boot time.

test nginx config and restart nginx

So Nginx is now installed as a reverse proxy for uWSGI application ‘Askbot’.

Step 6 – Test the setup

Open your web browser and visit the Askbot domain name: askbot.me, and you will get to see the home page, as shown below.

askbot domain

Here’s the Askbot user login page:

askbot login

Askbot user dashboard:

askbot dashboard

Askbot admin setting:

askbot admin dashboard

Askbot Django admin login:

Django admin login

Askbot Django admin dashboard:

Django admin dashboard

So the Q&A system application ‘Askbot’ has been successfully installed with uWSGI and Nginx web server on CentOS 7 server.

Reference

Harga Domain .ID Termurah Hanya 199rb

Di tulis oleh: