Usually I advice to build PostgreSQL from source as it gives the most flexibility. Another option is to use the official yum repositories. There is one repository for each supported release of PostgreSQL and most of the common RedHat based Linux distributions are listed: CentOS, Oracle Linux, RedHat, Fedora, Scientific Linux and even Amazon Linux.
Currently PostgreSQL 9.6 is in active development and new features get developed and committed. So lets try to add to the PostgreSQL 9.6 repository. I assume I do not need to say that the 9.6 version is not for anything else than testing at the moment.
As I am only Oracle Linux 7 with my VM I downloaded the repository rpm for this version. Once this is transferred to the VM installation is easy:
root@oel7 tmp] yum localinstall pgdg-oraclelinux96-9.6-1.noarch.rpm Loaded plugins: ulninfo Examining pgdg-oraclelinux96-9.6-1.noarch.rpm: pgdg-oraclelinux96-9.6-1.noarch Marking pgdg-oraclelinux96-9.6-1.noarch.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package pgdg-oraclelinux96.noarch 0:9.6-1 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================== Installing: pgdg-oraclelinux96 noarch 9.6-1 /pgdg-oraclelinux96-9.6-1.noarch 2.2 k Transaction Summary ======================================================================================================================================================== Install 1 Package Total size: 2.2 k Installed size: 2.2 k Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : pgdg-oraclelinux96-9.6-1.noarch 1/1 Verifying : pgdg-oraclelinux96-9.6-1.noarch 1/1 Installed: pgdg-oraclelinux96.noarch 0:9.6-1 Complete!
Lets see what is available:
[root@oel7 tmp] yum search postgresql96 Loaded plugins: ulninfo ============================================================== N/S matched: postgresql96 =============================================================== postgresql96-debuginfo.x86_64 : Debug information for package postgresql96 postgresql96.x86_64 : PostgreSQL client programs and libraries postgresql96-contrib.x86_64 : Contributed source and binaries distributed with PostgreSQL postgresql96-devel.x86_64 : PostgreSQL development header files and libraries postgresql96-docs.x86_64 : Extra documentation for PostgreSQL postgresql96-libs.x86_64 : The shared libraries required for any PostgreSQL clients postgresql96-plperl.x86_64 : The Perl procedural language for PostgreSQL postgresql96-plpython.x86_64 : The Python procedural language for PostgreSQL postgresql96-pltcl.x86_64 : The Tcl procedural language for PostgreSQL postgresql96-server.x86_64 : The programs needed to create and run a PostgreSQL server
Not as much as in the PostgreSQL 9.5 repo (e.g. all the utilities like pg_top) but it is perfect for testing new features. So lets install PostgreSQL 9.6:
[root@oel7 tmp] yum install postgresql96-server.x86_64 Loaded plugins: ulninfo Resolving Dependencies --> Running transaction check ---> Package postgresql96-server.x86_64 0:9.6-git20160121_1PGDG.rhel7 will be installed --> Processing Dependency: postgresql96-libs(x86-64) = 9.6-git20160121_1PGDG.rhel7 for package: postgresql96-server-9.6-git20160121_1PGDG.rhel7.x86_64 --> Processing Dependency: postgresql96(x86-64) = 9.6-git20160121_1PGDG.rhel7 for package: postgresql96-server-9.6-git20160121_1PGDG.rhel7.x86_64 --> Processing Dependency: postgresql96 = 9.6-git20160121_1PGDG.rhel7 for package: postgresql96-server-9.6-git20160121_1PGDG.rhel7.x86_64 --> Running transaction check ---> Package postgresql96.x86_64 0:9.6-git20160121_1PGDG.rhel7 will be installed ---> Package postgresql96-libs.x86_64 0:9.6-git20160121_1PGDG.rhel7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================== Installing: postgresql96-server x86_64 9.6-git20160121_1PGDG.rhel7 pgdg96 4.4 M Installing for dependencies: postgresql96 x86_64 9.6-git20160121_1PGDG.rhel7 pgdg96 1.2 M postgresql96-libs x86_64 9.6-git20160121_1PGDG.rhel7 pgdg96 204 k Transaction Summary ======================================================================================================================================================== Install 1 Package (+2 Dependent packages) Total download size: 5.8 M Installed size: 24 M Is this ok [y/d/N]: y Downloading packages: (1/3): postgresql96-9.6-git20160121_1PGDG.rhel7.x86_64.rpm | 1.2 MB 00:00:00 (2/3): postgresql96-libs-9.6-git20160121_1PGDG.rhel7.x86_64.rpm | 204 kB 00:00:01 (3/3): postgresql96-server-9.6-git20160121_1PGDG.rhel7.x86_64.rpm | 4.4 MB 00:00:01 -------------------------------------------------------------------------------------------------------------------------------------------------------- Total 2.5 MB/s | 5.8 MB 00:00:02 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : postgresql96-libs-9.6-git20160121_1PGDG.rhel7.x86_64 1/3 Installing : postgresql96-9.6-git20160121_1PGDG.rhel7.x86_64 2/3 Installing : postgresql96-server-9.6-git20160121_1PGDG.rhel7.x86_64 3/3 Verifying : postgresql96-9.6-git20160121_1PGDG.rhel7.x86_64 1/3 Verifying : postgresql96-server-9.6-git20160121_1PGDG.rhel7.x86_64 2/3 Verifying : postgresql96-libs-9.6-git20160121_1PGDG.rhel7.x86_64 3/3 Installed: postgresql96-server.x86_64 0:9.6-git20160121_1PGDG.rhel7 Dependency Installed: postgresql96.x86_64 0:9.6-git20160121_1PGDG.rhel7 postgresql96-libs.x86_64 0:9.6-git20160121_1PGDG.rhel7 Complete!
When you install from the official repositories all will be installed here:
[root@oel7 tmp] ls /usr/pgsql-9.6/ bin lib share [root@oel7 tmp] ls /usr/pgsql-9.6/bin/ clusterdb dropdb pg_archivecleanup pg_controldata pg_isready pg_rewind pg_xlogdump postmaster createdb droplang pg_basebackup pg_ctl pg_receivexlog pg_test_fsync postgres psql createlang dropuser pgbench pg_dump pg_resetxlog pg_test_timing postgresql96-check-db-dir reindexdb createuser initdb pg_config pg_dumpall pg_restore pg_upgrade postgresql96-setup vacuumdb
Creating, starting and connecting to a new PostgreSQL 9.6 instance is straight forward from now on:
[root@oel7 tmp] su - postgres Last login: Fri Jan 22 09:37:34 CET 2016 on pts/1 postgres@oel7:/home/postgres/ [dummy] mkdir data postgres@oel7:/home/postgres/ [dummy] /usr/pgsql-9.6/bin/initdb -D data/ The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. fixing permissions on existing directory data ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting dynamic shared memory implementation ... posix creating configuration files ... ok running bootstrap script ... ok performing post-bootstrap initialization ... ok syncing data to disk ... ok WARNING: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb. Success. You can now start the database server using: /usr/pgsql-9.6/bin/pg_ctl -D data/ -l logfile start postgres@oel7:/home/postgres/ [dummy] /usr/pgsql-9.6/bin/pg_ctl -D data/ -l /var/tmp/pg96.log start server starting postgres@oel7:/home/postgres/ [dummy] psql postgres Null display is "NULL". Timing is on. psql (9.6devel) Type "help" for help.
Here we go.
Btw: There are apt repositories as well, if you are on a debian based distribution.