How to deploy Python Application on AWS EC2 instance. ~Part3 PostgreSQL Installation~

First of all

In my previous article, your application is uploaded to GitHub repository. This time, let’s create database for your application by installing latest postgreSQL.

Install PostgreSQL

Firstly, install yum repository of PostgreSQL by executing yum command as below.
* If you’ve installed old version postgreSQL, please remove it in advance.

Then, install postgresql13-server. postgresql13 and postgresql13-libs packages are installed automatically by considering package dependency.

Check if postgresql related directory and user/group are created as below.

Then, switch user to postgres and create database cluster by executing “initdb” command.

Preparation is completed. Let’s start postgresql server by “systemctl” command.

OK, postgresql server is started successfully !!

These are additional setting. Auto starting setting is added as below.

And, it is better to set environment variable.

Finally, please check if database is created successfully.

Database preparation

Create database for your application. You can decide database name and user name as you like.
Manipulate your database by entering database by psql command.

That’s all for postgresql installation.
In my next article, I would like you to show how to deploy your application to AWS EC2 instance.
Please check it !!