How to install PostgreSQL 10 on Amazon EC2 (Amazon Linux)

Install PostgreSQL 10 on Amazon EC2

Post Updated

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.

install PostgreSQL 10 on amazon ec2

 

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

Read Also: How to install PostgreSQL 11 on Mac OS X via brew

Read Also: How to install PostgreSQL 10 on Debian 9

Step 1. Install PostgreSQL 10

Firstly we need to add the pgdg repository in Amazon Linux

amazon-linux-extras install postgresql10 vim epel -y

Step 2. Install PostgreSQL 10

yum install -y postgresql-server postgresql-devel

Create a new Postgres database cluster

/usr/bin/postgresql-setup --initdb

* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

Step 4. Start the services of Postgres

Now execute the following command to start and enable the postgres services.

systemctl enable postgresql
systemctl start postgresql

How to install postgresql 9.6 on Mac

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

psql

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.

Read Also: How to install PostgreSQL 9.5 on CentOS 7 / Redhat 7

4 Comments Posted

  1. Hi,

    This gives me an error. Please help. Thanks.

    [ec2-user@ip-172-31-16-173 ~]$ sudo yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/p
    gdg-centos10-10-2.noarch.rpm
    Loaded plugins: priorities, update-motd, upgrade-helper
    pgdg-centos10-10-2.noarch.rpm | 5.6 kB 00:00:00
    Examining /var/tmp/yum-root-3pEhlc/pgdg-centos10-10-2.noarch.rpm: pgdg-redhat-repo-42.0-4.noarch
    Marking /var/tmp/yum-root-3pEhlc/pgdg-centos10-10-2.noarch.rpm to be installed
    Resolving Dependencies
    amzn-main/2018.03 | 2.1 kB 00:00:00
    amzn-updates/2018.03 | 2.5 kB 00:00:00
    –> Running transaction check
    —> Package pgdg-redhat-repo.noarch 0:42.0-4 will be installed
    –> Processing Dependency: /etc/redhat-release for package: pgdg-redhat-repo-42.0-4.noarch
    –> Processing Dependency: /etc/redhat-release for package: pgdg-redhat-repo-42.0-4.noarch
    –> Finished Dependency Resolution
    Error: Package: pgdg-redhat-repo-42.0-4.noarch (/pgdg-centos10-10-2.noarch)
    Requires: /etc/redhat-release
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

Leave a Reply

Your email address will not be published.


*