Cài đặt từ yum reporitory
Bạn có thể download reporitory RPMs tương ứng ở đây, sau khi cài đặt dùng lệnh yum để cài đặt packages cần thiết. Ở ví dụ bên dưới, mình đã install 4 packages thông dụng của PostgreSQL. Sau khi cài đặt bạn có thể tạo database cluster bằng lệnh initdb.
[root@localhost src]# wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
--2017-05-21 22:26:49-- https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
Resolving download.postgresql.org (download.postgresql.org)... 174.143.35.246, 204.145.124.244, 217.196.149.55, ...
Connecting to download.postgresql.org (download.postgresql.org)|174.143.35.246|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4816 (4.7K) [application/x-redhat-package-manager]
Saving to: 'pgdg-redhat96-9.6-3.noarch.rpm'
100%[===================================================================================================================================================================================================>] 4,816 --.-K/s in 0.005s
2017-05-21 22:26:50 (902 KB/s) - 'pgdg-redhat96-9.6-3.noarch.rpm'saved [4816/4816]
[root@localhost src]# rpm -ivh pgdg-redhat96-9.6-3.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:pgdg-redhat96-9.6-3 ################################# [100%]
[root@localhost src]# yum search postgresql96
Loaded plugins: fastestmirror, langpacks
pgdg96 | 4.1 kB 00:00:00
(1/2): pgdg96/7/x86_64/group_gz | 249 B 00:00:01
(2/2): pgdg96/7/x86_64/primary_db | 137 kB 00:00:01
Loading mirror speeds from cached hostfile
* base: ftp.riken.jp
* extras: ftp.riken.jp
* updates: ftp.riken.jp
========================================================================================================= N/S matched: postgresql96 =========================================================================================================
postgresql96-debuginfo.x86_64 : Debug information for package postgresql96
postgresql96-tcl-debuginfo.x86_64 : Debug information for package postgresql96-tcl
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-odbc.x86_64 : PostgreSQL ODBC driver
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
postgresql96-tcl.x86_64 : A Tcl client library for PostgreSQL
postgresql96-test.x86_64 : The test suite distributed with PostgreSQL
Name and summary matches only, use "search all" for everything.
[root@localhost src]# yum install postgresql96.x86_64 postgresql96-contrib.x86_64 postgresql96-libs.x86_64 postgresql96-server.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.riken.jp
* extras: ftp.riken.jp
* updates: ftp.riken.jp
Resolving Dependencies
--> Running transaction check
---> Package postgresql96.x86_64 0:9.6.3-1PGDG.rhel7 will be installed
---> Package postgresql96-contrib.x86_64 0:9.6.3-1PGDG.rhel7 will be installed
---> Package postgresql96-libs.x86_64 0:9.6.3-1PGDG.rhel7 will be installed
---> Package postgresql96-server.x86_64 0:9.6.3-1PGDG.rhel7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================================================================
Installing:
postgresql96 x86_64 9.6.3-1PGDG.rhel7 pgdg96 1.3 M
postgresql96-contrib x86_64 9.6.3-1PGDG.rhel7 pgdg96 563 k
postgresql96-libs x86_64 9.6.3-1PGDG.rhel7 pgdg96 310 k
postgresql96-server x86_64 9.6.3-1PGDG.rhel7 pgdg96 4.3 M
Transaction Summary
=============================================================================================================================================================================================================================================
Install 4 Packages
Total download size: 6.5 M
Installed size: 28 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): postgresql96-contrib-9.6.3-1PGDG.rhel7.x86_64.rpm | 563 kB 00:00:03
(2/4): postgresql96-libs-9.6.3-1PGDG.rhel7.x86_64.rpm | 310 kB 00:00:00
(3/4): postgresql96-9.6.3-1PGDG.rhel7.x86_64.rpm | 1.3 MB 00:00:05
(4/4): postgresql96-server-9.6.3-1PGDG.rhel7.x86_64.rpm | 4.3 MB 00:00:05
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 686 kB/s | 6.5 MB 00:00:09
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : postgresql96-libs-9.6.3-1PGDG.rhel7.x86_64 1/4
Installing : postgresql96-9.6.3-1PGDG.rhel7.x86_64 2/4
Installing : postgresql96-contrib-9.6.3-1PGDG.rhel7.x86_64 3/4
Installing : postgresql96-server-9.6.3-1PGDG.rhel7.x86_64 4/4
Verifying : postgresql96-contrib-9.6.3-1PGDG.rhel7.x86_64 1/4
Verifying : postgresql96-libs-9.6.3-1PGDG.rhel7.x86_64 2/4
Verifying : postgresql96-server-9.6.3-1PGDG.rhel7.x86_64 3/4
Verifying : postgresql96-9.6.3-1PGDG.rhel7.x86_64 4/4
Installed:
postgresql96.x86_64 0:9.6.3-1PGDG.rhel7 postgresql96-contrib.x86_64 0:9.6.3-1PGDG.rhel7 postgresql96-libs.x86_64 0:9.6.3-1PGDG.rhel7 postgresql96-server.x86_64 0:9.6.3-1PGDG.rhel7
Complete!
[root@localhost src]#
[root@localhost src]# ls /usr/pgsql-9.6/
bin doc lib share
root@localhost src]# ls /usr/pgsql-9.6/bin/
clusterdb createuser dropuser pg_archivecleanup pg_config pg_dump pg_receivexlog pg_restore pg_test_fsync pg_xlogdump postgresql96-setup reindexdb
createdb dropdb initdb pg_basebackup pg_controldata pg_dumpall pg_recvlogical pg_rewind pg_test_timing postgres postmaster vacuumdb
createlang droplang oid2name pgbench pg_ctl pg_isready pg_resetxlog pg_standby pg_upgrade postgresql96-check-db-dir psql vacuumlo
[root@localhost src]#