Install PostgreSQL 10 on Amazon EC2
In this tutorial, we will show you How to install PostgreSQL 10 on Amazon EC2. You will see how to Install PostgreSQL 10 on Amazon Linux is very easy and quick to install and use.
Amazon Linux 2 is the next generation of Amazon Linux, a Linux server operating system from Amazon Web Services (AWS). It provides a secure, stable, and high-performance execution environment to develop and run cloud and enterprise applications. With Amazon Linux 2, you get an application environment that offers long term support with access to the latest innovations in the Linux ecosystem. Amazon Linux 2 is provided at no additional charge.
PostgreSQL, often simply Postgres, is an open source object-relational database management system (ORDBMS) with an emphasis on extensibility and standards compliance. It can handle workloads ranging from small single-machine applications to large Internet-facing applications (or for data warehousing) with many concurrent users. It is the default database on macOS Server and is available for Microsoft Windows and Linux (supplied in most distributions).
Step 1. Add PGDG Repo
Firstly we need to add the pgdg repository in Amazon Linux
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
Now we need to change the release server to redhat so we can use this repository.
sed -i "s/rhel-\$releasever-\$basearch/rhel-7.5-x86_64/g" "/etc/yum.repos.d/pgdg-10-centos.repo"
Step 2. Install PostgreSQL 10 Client
To install PostgreSQL us the following command. It will install complete postgreSQL Database group.
yum install postgresql10
Step 3. Install PostgreSQL 10
yum install postgresql10-server
Create a new Postgres database cluster
Initializing database ... OK
Step 4. Restart the services of Postgres
Now execute the following command to start and enable the postgres services.
systemctl enable postgresql-10
systemctl start postgresql-10
Step 5. Login into Database
PostgreSQL installation is done. If you want to use the Database log in Postgres account by typing following command
su - postgres
You can get into Postgres console by typing
Now use the Postgres as you want to use. To get the help use the \h command.
Read Also: Useful s3 commands
If you have any problem using this tutorial feel free to comment.