PostgreSQL Installation using Yum

[root@ip-10-0-0-14 ec2-user]# sudo yum install postgresql-server postgresql-*
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest | 2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
4 packages excluded due to repository priority protections
Resolving Dependencies
–> Running transaction check
—> Package postgresql-jdbc.noarch 0:8.4.701-8.11.amzn1 will be installed
—> Package postgresql-odbc.x86_64 0:08.04.0200-1.6.amzn1 will be installed
–> Processing Dependency: libodbcinst.so.2()(64bit) for package: postgresql-odbc-08.04.0200-1.6.amzn1.x86_64
–> Processing Dependency: libodbc.so.2()(64bit) for package: postgresql-odbc-08.04.0200-1.6.amzn1.x86_64
—> Package postgresql92-server-compat.x86_64 0:9.2.10-1.53.amzn1 will be installed
–> Processing Dependency: postgresql92-server(x86-64) = 9.2.10-1.53.amzn1 for package: postgresql92-server-compat-9.2.10-1.53.amzn1.x86_64
–> Running transaction check
—> Package postgresql92-server.x86_64 0:9.2.10-1.53.amzn1 will be installed
–> Processing Dependency: postgresql92(x86-64) = 9.2.10-1.53.amzn1 for package: postgresql92-server-9.2.10-1.53.amzn1.x86_64
—> Package unixODBC.x86_64 0:2.2.14-14.7.amzn1 will be installed
–> Processing Dependency: libltdl.so.7()(64bit) for package: unixODBC-2.2.14-14.7.amzn1.x86_64
–> Running transaction check
—> Package libtool-ltdl.x86_64 0:2.4.2-20.4.8.2.23.amzn1 will be installed
—> Package postgresql92.x86_64 0:9.2.10-1.53.amzn1 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
postgresql-jdbc noarch 8.4.701-8.11.amzn1 amzn-main 405 k
postgresql-odbc x86_64 08.04.0200-1.6.amzn1 amzn-main 293 k
postgresql92-server-compat x86_64 9.2.10-1.53.amzn1 amzn-main 38 k
Installing for dependencies:
libtool-ltdl x86_64 2.4.2-20.4.8.2.23.amzn1 amzn-main 51 k
postgresql92 x86_64 9.2.10-1.53.amzn1 amzn-main 4.0 M
postgresql92-server x86_64 9.2.10-1.53.amzn1 amzn-main 5.9 M
unixODBC x86_64 2.2.14-14.7.amzn1 amzn-main 483 k

Transaction Summary
========================================================================================================================================================================
Install 3 Packages (+4 Dependent packages)

Total download size: 11 M
Installed size: 34 M
Is this ok [y/d/N]: y
Downloading packages:
(1/7): libtool-ltdl-2.4.2-20.4.8.2.23.amzn1.x86_64.rpm | 51 kB 00:00
(2/7): postgresql-jdbc-8.4.701-8.11.amzn1.noarch.rpm | 405 kB 00:00
(3/7): postgresql-odbc-08.04.0200-1.6.amzn1.x86_64.rpm | 293 kB 00:00
(4/7): postgresql92-9.2.10-1.53.amzn1.x86_64.rpm | 4.0 MB 00:00
(5/7): postgresql92-server-9.2.10-1.53.amzn1.x86_64.rpm | 5.9 MB 00:00
(6/7): postgresql92-server-compat-9.2.10-1.53.amzn1.x86_64.rpm | 38 kB 00:00
(7/7): unixODBC-2.2.14-14.7.amzn1.x86_64.rpm | 483 kB 00:00
————————————————————————————————————————————————————————
Total 31 MB/s | 11 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libtool-ltdl-2.4.2-20.4.8.2.23.amzn1.x86_64 1/7
Installing : unixODBC-2.2.14-14.7.amzn1.x86_64 2/7
Installing : postgresql92-9.2.10-1.53.amzn1.x86_64 3/7
Installing : postgresql92-server-9.2.10-1.53.amzn1.x86_64 4/7
Installing : postgresql92-server-compat-9.2.10-1.53.amzn1.x86_64 5/7
Installing : postgresql-odbc-08.04.0200-1.6.amzn1.x86_64 6/7
Installing : postgresql-jdbc-8.4.701-8.11.amzn1.noarch 7/7
Verifying : postgresql92-server-compat-9.2.10-1.53.amzn1.x86_64 1/7
Verifying : postgresql92-9.2.10-1.53.amzn1.x86_64 2/7
Verifying : postgresql-jdbc-8.4.701-8.11.amzn1.noarch 3/7
Verifying : libtool-ltdl-2.4.2-20.4.8.2.23.amzn1.x86_64 4/7
Verifying : postgresql-odbc-08.04.0200-1.6.amzn1.x86_64 5/7
Verifying : postgresql92-server-9.2.10-1.53.amzn1.x86_64 6/7
Verifying : unixODBC-2.2.14-14.7.amzn1.x86_64 7/7

Installed:
postgresql-jdbc.noarch 0:8.4.701-8.11.amzn1 postgresql-odbc.x86_64 0:08.04.0200-1.6.amzn1 postgresql92-server-compat.x86_64 0:9.2.10-1.53.amzn1

Dependency Installed:
libtool-ltdl.x86_64 0:2.4.2-20.4.8.2.23.amzn1 postgresql92.x86_64 0:9.2.10-1.53.amzn1 postgresql92-server.x86_64 0:9.2.10-1.53.amzn1
unixODBC.x86_64 0:2.2.14-14.7.amzn1

Complete!
[root@ip-10-0-0-14 ec2-user]#
[root@ip-10-0-0-14 ec2-user]#
[root@ip-10-0-0-14 ec2-user]#
[root@ip-10-0-0-14 ec2-user]#
[root@ip-10-0-0-14 ec2-user]#
[root@ip-10-0-0-14 ~]# service postgresql initdb
Initializing database: [ OK ]
[root@ip-10-0-0-14 ~]#
[root@ip-10-0-0-14 ~]#
[root@ip-10-0-0-14 ~]# service postgresql start
Starting postgresql service: [ OK ]
[root@ip-10-0-0-14 ~]#
[root@ip-10-0-0-14 ~]#
[root@ip-10-0-0-14 ~]# su – postgres
Last login: Tue May 5 10:40:01 UTC 2015 on pts/0
[postgres@ip-10-0-0-14 ~]$
[postgres@ip-10-0-0-14 ~]$
[postgres@ip-10-0-0-14 ~]$
[postgres@ip-10-0-0-14 ~]$ /usr/lib64/pgsql92/bin/createdb test
[postgres@ip-10-0-0-14 ~]$
[postgres@ip-10-0-0-14 ~]$
[postgres@ip-10-0-0-14 ~]$ /usr/lib64/pgsql92/bin/psql test
psql (9.2.10)
Type “help” for help.

test=#

[postgres@ip-10-0-0-14 ~]$ ll -lhtr /var/lib/pgsql9/data/
total 96K
-rw——- 1 postgres postgres 4 May 7 11:21 PG_VERSION
drwx—— 2 postgres postgres 4.0K May 7 11:21 pg_twophase
drwx—— 2 postgres postgres 4.0K May 7 11:21 pg_tblspc
drwx—— 2 postgres postgres 4.0K May 7 11:21 pg_snapshots
drwx—— 2 postgres postgres 4.0K May 7 11:21 pg_serial
drwx—— 4 postgres postgres 4.0K May 7 11:21 pg_multixact
-rw——- 1 postgres postgres 20K May 7 11:21 postgresql.conf
-rw——- 1 postgres postgres 1.6K May 7 11:21 pg_ident.conf
-rw——- 1 postgres postgres 4.2K May 7 11:21 pg_hba.conf
drwx—— 3 postgres postgres 4.0K May 7 11:21 pg_xlog
drwx—— 2 postgres postgres 4.0K May 7 11:21 pg_subtrans
drwx—— 2 postgres postgres 4.0K May 7 11:21 pg_clog
-rw——- 1 postgres postgres 93 May 7 11:21 postmaster.pid
-rw——- 1 postgres postgres 72 May 7 11:21 postmaster.opts
drwx—— 2 postgres postgres 4.0K May 7 11:21 pg_notify
drwx—— 2 postgres postgres 4.0K May 7 11:21 pg_log
drwx—— 6 postgres postgres 4.0K May 7 11:21 base
drwx—— 2 postgres postgres 4.0K May 7 11:22 global
drwx—— 2 postgres postgres 4.0K May 7 11:23 pg_stat_tmp
[postgres@ip-10-0-0-14 ~]$

[postgres@ip-10-0-0-228 ~]$ ps -ef | grep post
postgres 2032 1 0 10:46 ? 00:00:00 /usr/lib64/pgsql92/bin/postmaster -p 5432 -D /var/lib/pgsql9/data
postgres 2034 2032 0 10:46 ? 00:00:00 postgres: logger process
postgres 2036 2032 0 10:46 ? 00:00:00 postgres: checkpointer process
postgres 2037 2032 0 10:46 ? 00:00:00 postgres: writer process
postgres 2038 2032 0 10:46 ? 00:00:00 postgres: wal writer process
postgres 2039 2032 0 10:46 ? 00:00:00 postgres: autovacuum launcher process
postgres 2040 2032 0 10:46 ? 00:00:00 postgres: stats collector process
root 2067 1350 0 10:53 pts/0 00:00:00 su – postgres
postgres 2068 2067 0 10:53 pts/0 00:00:00 -bash
postgres 2098 2068 0 10:53 pts/0 00:00:00 ps -ef
postgres 2099 2068 0 10:53 pts/0 00:00:00 grep post
[postgres@ip-10-0-0-228 ~]$
[postgres@ip-10-0-0-228 ~]$ /usr/lib64/pgsql92/bin/createdb test
[postgres@ip-10-0-0-228 ~]$
[postgres@ip-10-0-0-228 ~]$
[postgres@ip-10-0-0-228 ~]$ /usr/lib64/pgsql92/bin/psql test
psql (9.2.10)
Type “help” for help.

test=#
test=#

  • Ask Question