How to install PostgreSQL on AWS EC2, and how can I access that
Depending upon the OS (I have considered Amazon Linux, yum based installation)
Amazon Linux (assuming instance is launched and port 5432 is opened for PostgreSQL access and 22 for SSH Access)
SSH into instance and run the following commands -
- sudo yum update
- sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
Once the above installation completes, initialize the DB
- sudo service postgresql initdb
Edit the pg_hba config file -
- sudo vim /var/lib/pgsql9/data/pg_hba.conf
Update the bottom of the file, which will read something like this, by default:
- # TYPE DATABASE USER ADDRESS METHOD
- # "local" is for Unix domain socket connections only
- local all all ident
- # IPv4 local connections:
- host all all 127.0.0.1/32 ident
- # IPv6 local connections:
- host all all ::1/128 ident
To read this:
- # TYPE DATABASE USER ADDRESS METHOD
- # "local" is for Unix domain socket connections only
- local all all trust
- # IPv4 local connections:
- host all power_user 0.0.0.0/0 md5
- host all other_user 0.0.0.0/0 md5
- host all storageLoader 0.0.0.0/0 md5
- # IPv6 local connections:
- host all all ::1/128 md5
Edit the following file -
- sudo vim /var/lib/pgsql9/data/postgresql.conf
Uncomment and edit the following lines -
- #listen_addresses = 'localhost'
to
- listen_addresses='*'
and
- #port = 5432
to
- port = 5432
Start PostgreSQL server,
- sudo service postgresql start
Login into Postgres user -
- sudo su - postgres
- psql -U postgres
Change your login password -
- ALTER USER postgres WITH PASSWORD '';
You can create more users with their passwords using the following example (replace variables with actual secure passwords)
- CREATE USER power_user SUPERUSER;
- ALTER USER power_user WITH PASSWORD '';
For further details visit the following links for detailed installation guides for other OS and compilation from source -
Snowplow (on github)
PostgreSQL Installation guides
How To Install and Use PostgreSQL on Ubuntu 16.04
Articoli simili
- Qual è la differenza tra CBS All Access attraverso Amazon e CBS All Access?
- Can I install a custom ROM without losing any data?
- Come importare un database PostgreSQL con pgAdmin
- What is a reliable VoIP provider that offers UK and German numbers, inbound + outbound and also has Android and iPhone apps?