至官網https://www.postgresql.org/ 點選Downloads
選擇自己適合的作業系統版本
- Red Hat family Linux (including CentOS/Fedora/Scientific/Oracle variants)
進入後1.2.3部份選取自己要的版本--1.2.3選擇好後,選項4.5.6.7會自動產生
Select version: 1211109.69.59.4
●10
Select platform:
●RedHat Enterprise,CentOS,Scientific或Oracle版本6
Select architecture:
●x86_64
Install the repository RPM:
直接COPY安裝指令在LINUX上執行
[root@rosalie-mysql02 ~]# yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Loaded plugins: fastestmirror
Setting up Install Process
pgdg-redhat-repo-latest.noarch.rpm | 5.8 kB 00:00
Examining /var/tmp/yum-root-XHUpda/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-5.noarch
Marking /var/tmp/yum-root-XHUpda/pgdg-redhat-repo-latest.noarch.rpm to be installed
Determining fastest mirrors
epel/metalink | 5.0 kB 00:00
* base: mirror01.idc.hinet.net
* epel: fedora.cs.nctu.edu.tw
* extras: mirror01.idc.hinet.net
* updates: mirror01.idc.hinet.net
base | 3.7 kB 00:00
dockerrepo | 2.9 kB 00:00
epel | 5.3 kB 00:00
epel/primary_db | 6.1 MB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 6.6 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-5 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================
Installing:
pgdg-redhat-repo noarch 42.0-5 /pgdg-redhat-repo-latest.noarch 7.5 k
Transaction Summary
=======================================================================================================================================
Install 1 Package(s)
Total size: 7.5 k
Installed size: 7.5 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : pgdg-redhat-repo-42.0-5.noarch 1/1
Verifying : pgdg-redhat-repo-42.0-5.noarch 1/1
Installed:
pgdg-redhat-repo.noarch 0:42.0-5
Complete!
- Install the client packages: (安裝客戶端軟件包)
●yum install postgresql10
[root@rosalie-mysql02 ~]# yum install postgresql10
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror01.idc.hinet.net
* epel: fedora.cs.nctu.edu.tw
* extras: mirror01.idc.hinet.net
* updates: mirror01.idc.hinet.net
pgdg10 | 3.7 kB 00:00
pgdg10/primary_db | 256 kB 00:00
pgdg11 | 3.6 kB 00:00
pgdg11/primary_db | 214 kB 00:00
pgdg12 | 3.6 kB 00:00
pgdg12/primary_db | 106 kB 00:00
pgdg94 | 3.7 kB 00:00
pgdg94/primary_db | 272 kB 00:00
pgdg95 | 3.7 kB 00:00
pgdg95/primary_db | 289 kB 00:00
pgdg96 | 3.7 kB 00:00
pgdg96/primary_db | 283 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package postgresql10.x86_64 0:10.10-1PGDG.rhel6 will be installed
--> Processing Dependency: postgresql10-libs(x86-64) = 10.10-1PGDG.rhel6 for package: postgresql10-10.10-1PGDG.rhel6.x86_64
--> Processing Dependency: libicu for package: postgresql10-10.10-1PGDG.rhel6.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql10-10.10-1PGDG.rhel6.x86_64
--> Running transaction check
---> Package libicu.x86_64 0:4.2.1-14.el6 will be installed
---> Package postgresql10-libs.x86_64 0:10.10-1PGDG.rhel6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================
Installing:
postgresql10 x86_64 10.10-1PGDG.rhel6 pgdg10 1.6 M
Installing for dependencies:
libicu x86_64 4.2.1-14.el6 base 4.9 M
postgresql10-libs x86_64 10.10-1PGDG.rhel6 pgdg10 327 k
Transaction Summary
=======================================================================================================================================
Install 3 Package(s)
Total download size: 6.9 M
Installed size: 28 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): libicu-4.2.1-14.el6.x86_64.rpm | 4.9 MB 00:00
(2/3): postgresql10-10.10-1PGDG.rhel6.x86_64.rpm | 1.6 MB 00:02
(3/3): postgresql10-libs-10.10-1PGDG.rhel6.x86_64.rpm | 327 kB 00:00
---------------------------------------------------------------------------------------------------------------------------------------
Total 1.4 MB/s | 6.9 MB 00:05
warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid : PostgreSQL RPM Building Project <pgsqlrpms-hackers@pgfoundry.org>
Package: pgdg-redhat-repo-42.0-5.noarch (@/pgdg-redhat-repo-latest.noarch)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : postgresql10-libs-10.10-1PGDG.rhel6.x86_64 1/3
Installing : libicu-4.2.1-14.el6.x86_64 2/3
Installing : postgresql10-10.10-1PGDG.rhel6.x86_64 3/3
Verifying : libicu-4.2.1-14.el6.x86_64 1/3
Verifying : postgresql10-10.10-1PGDG.rhel6.x86_64 2/3
Verifying : postgresql10-libs-10.10-1PGDG.rhel6.x86_64 3/3
Installed:
postgresql10.x86_64 0:10.10-1PGDG.rhel6
Dependency Installed:
libicu.x86_64 0:4.2.1-14.el6 postgresql10-libs.x86_64 0:10.10-1PGDG.rhel6
Complete!
- Optionally install the server packages: (安裝服務器軟件包)
●yum install postgresql10-server
[root@rosalie-mysql02 ~]# yum install postgresql10-server
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror01.idc.hinet.net
* epel: fedora.cs.nctu.edu.tw
* extras: mirror01.idc.hinet.net
* updates: mirror01.idc.hinet.net
Resolving Dependencies
--> Running transaction check
---> Package postgresql10-server.x86_64 0:10.10-1PGDG.rhel6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================
Installing:
postgresql10-server x86_64 10.10-1PGDG.rhel6 pgdg10 5.1 M
Transaction Summary
=======================================================================================================================================
Install 1 Package(s)
Total download size: 5.1 M
Installed size: 18 M
Is this ok [y/N]: y
Downloading Packages:
postgresql10-server-10.10-1PGDG.rhel6.x86_64.rpm | 5.1 MB 00:03
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : postgresql10-server-10.10-1PGDG.rhel6.x86_64 1/1
Verifying : postgresql10-server-10.10-1PGDG.rhel6.x86_64 1/1
Installed:
postgresql10-server.x86_64 0:10.10-1PGDG.rhel6
Complete!
- Optionally initialize the database and enable automatic start:
●service postgresql-10 initdb
●chkconfig postgresql-10 on
●service postgresql-10 start
[root@rosalie-mysql02 ~]# service postgresql-10 initdb
Initializing database: [ OK ]
[root@rosalie-mysql02 ~]# chkconfig postgresql-10 on
[root@rosalie-mysql02 ~]# service postgresql-10 start
Starting postgresql-10 service: [ OK ]
[postgres@rosalie-mysql02 ~]$ service postgresql-10 status
postgresql-10 (pid 15039) is running...
安裝完成