centos7 在线安装新版pg11+ llvm jit

一、更新源

地址:https://yum.postgresql.org/repopackages.php

yum源

获取到以上yum源链接地址:
centos7:
https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

centos6:
https://download.postgresql.org/pub/repos/yum/reporpms/EL-6/pgdg-redhat-repo-latest.noarch.rpm

安装yum源:

wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
yum install  -y  https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum clean all  
yum makecache

二、安装postgresql

  1. 先查看postgreql源
[root@Hemny ~]# yum list | grep postgresql11
postgresql11.x86_64                     11.2-2PGDG.rhel7               pgdg11   
postgresql11-contrib.x86_64             11.2-2PGDG.rhel7               pgdg11   
postgresql11-debuginfo.x86_64           11.2-2PGDG.rhel7               pgdg11   
postgresql11-devel.x86_64               11.2-2PGDG.rhel7               pgdg11   
postgresql11-docs.x86_64                11.2-2PGDG.rhel7               pgdg11   
postgresql11-libs.x86_64                11.2-2PGDG.rhel7               pgdg11   
postgresql11-llvmjit.x86_64             11.2-2PGDG.rhel7               pgdg11   
postgresql11-odbc.x86_64                11.00.0000-1PGDG.rhel7         pgdg11   
postgresql11-plperl.x86_64              11.2-2PGDG.rhel7               pgdg11   
postgresql11-plpython.x86_64            11.2-2PGDG.rhel7               pgdg11   
postgresql11-pltcl.x86_64               11.2-2PGDG.rhel7               pgdg11   
postgresql11-server.x86_64              11.2-2PGDG.rhel7               pgdg11   
postgresql11-tcl.x86_64                 2.4.0-2.rhel7.1                pgdg11   
postgresql11-test.x86_64                11.2-2PGDG.rhel7               pgdg11   

postgresql11.x86_64【postgresql的数据库工具组件,包含很多管理数据库组件】
postgresql11-contrib.x86_64【postgresql的extension,提供较多的拓展功能】
postgresql11-debuginfo.x86_64【postgresql的调试包】
postgresql11-devel.x86_64【postgresql的开发包,包含.h头文件等】
postgresql11-docs.x86_64【postgresql的说明文档】
postgresql11-libs.x86_64【postgresql的动态库,依赖安装】
postgresql11-llvmjit.x86_64【postgresql的llvmjit 即时编译器】
postgresql11-odbc.x86_64【postgresql的odbc相关组件】
postgresql11-plperl.x86_64【postgresql的PL/Perl,如果使用Perl开发函数,需要安装】
postgresql11-plpython.x86_64【postgresql的PL/python,如果使用python开发函数,需要安装】
postgresql11-pltcl.x86_64【postgresql的PL/tcl,如果使用tcl开发函数,需要安装】
postgresql11-server.x86_64【postgresql的服务端】
postgresql11-tcl.x86_64【postgresql的PL/tcl依赖的TCL程序包】
postgresql11-test.x86_64【postgresql的回归测试组件】

  1. 安装postgresql。

输入命令:

yum install -y postgresql11*

安装过程:

[root@Hemny ~]# yum install -y postgresql11*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.neusoft.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package postgresql11.x86_64 0:11.2-2PGDG.rhel7 will be installed
---> Package postgresql11-contrib.x86_64 0:11.2-2PGDG.rhel7 will be installed
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: postgresql11-contrib-11.2-2PGDG.rhel7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: postgresql11-contrib-11.2-2PGDG.rhel7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: postgresql11-contrib-11.2-2PGDG.rhel7.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: postgresql11-contrib-11.2-2PGDG.rhel7.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: postgresql11-contrib-11.2-2PGDG.rhel7.x86_64
---> Package postgresql11-debuginfo.x86_64 0:11.2-2PGDG.rhel7 will be installed
---> Package postgresql11-devel.x86_64 0:11.2-2PGDG.rhel7 will be installed
--> Processing Dependency: libicu-devel for package: postgresql11-devel-11.2-2PGDG.rhel7.x86_64
---> Package postgresql11-docs.x86_64 0:11.2-2PGDG.rhel7 will be installed
---> Package postgresql11-libs.x86_64 0:11.2-2PGDG.rhel7 will be installed
---> Package postgresql11-llvmjit.x86_64 0:11.2-2PGDG.rhel7 will be installed
--> Processing Dependency: llvm5.0 >= 5.0 for package: postgresql11-llvmjit-11.2-2PGDG.rhel7.x86_64
--> Processing Dependency: libLLVM-5.0.so()(64bit) for package: postgresql11-llvmjit-11.2-2PGDG.rhel7.x86_64
---> Package postgresql11-odbc.x86_64 0:11.00.0000-1PGDG.rhel7 will be installed
--> Processing Dependency: libodbcinst.so.2()(64bit) for package: postgresql11-odbc-11.00.0000-1PGDG.rhel7.x86_64
---> Package postgresql11-plperl.x86_64 0:11.2-2PGDG.rhel7 will be installed
--> Processing Dependency: perl(:MODULE_COMPAT_5.16.3) for package: postgresql11-plperl-11.2-2PGDG.rhel7.x86_64
---> Package postgresql11-plpython.x86_64 0:11.2-2PGDG.rhel7 will be installed
---> Package postgresql11-pltcl.x86_64 0:11.2-2PGDG.rhel7 will be installed
--> Processing Dependency: tcl for package: postgresql11-pltcl-11.2-2PGDG.rhel7.x86_64
--> Processing Dependency: libtcl8.5.so()(64bit) for package: postgresql11-pltcl-11.2-2PGDG.rhel7.x86_64
---> Package postgresql11-server.x86_64 0:11.2-2PGDG.rhel7 will be installed
---> Package postgresql11-tcl.x86_64 0:2.4.0-2.rhel7.1 will be installed
---> Package postgresql11-test.x86_64 0:11.2-2PGDG.rhel7 will be installed
--> Running transaction check
---> Package libicu-devel.x86_64 0:50.1.2-17.el7 will be installed
---> Package libxslt.x86_64 0:1.1.28-5.el7 will be installed
---> Package llvm5.0.x86_64 0:5.0.1-7.el7 will be installed
---> Package llvm5.0-libs.x86_64 0:5.0.1-7.el7 will be installed
---> Package perl.x86_64 4:5.16.3-294.el7_6 will be installed
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-294.el7_6.x86_64
---> Package perl-libs.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package tcl.x86_64 1:8.5.13-8.el7 will be installed
---> Package unixODBC.x86_64 0:2.3.1-11.el7 will be installed
--> Processing Dependency: libltdl.so.7()(64bit) for package: unixODBC-2.3.1-11.el7.x86_64
--> Running transaction check
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-4.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
---> Package perl-macros.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
--> Running transaction check
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-294.el7_6 will be installed
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
--> Running transaction check
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================
 Package                                                  Arch                                     Version                                                    Repository                                 Size
==============================================================================================================================================================================================================
Installing:
 postgresql11                                             x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                    1.6 M
 postgresql11-contrib                                     x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                    616 k
 postgresql11-debuginfo                                   x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                     10 M
 postgresql11-devel                                       x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                    2.0 M
 postgresql11-docs                                        x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                     11 M
 postgresql11-libs                                        x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                    360 k
 postgresql11-llvmjit                                     x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                    9.0 M
 postgresql11-odbc                                        x86_64                                   11.00.0000-1PGDG.rhel7                                     pgdg11                                    283 k
 postgresql11-plperl                                      x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                     61 k
 postgresql11-plpython                                    x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                     82 k
 postgresql11-pltcl                                       x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                     39 k
 postgresql11-server                                      x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                    4.7 M
 postgresql11-tcl                                         x86_64                                   2.4.0-2.rhel7.1                                            pgdg11                                    309 k
 postgresql11-test                                        x86_64                                   11.2-2PGDG.rhel7                                           pgdg11                                    1.7 M
Installing for dependencies:
 libicu-devel                                             x86_64                                   50.1.2-17.el7                                              base                                      702 k
 libtool-ltdl                                             x86_64                                   2.4.2-22.el7_3                                             base                                       49 k
 libxslt                                                  x86_64                                   1.1.28-5.el7                                               base                                      242 k
 llvm5.0                                                  x86_64                                   5.0.1-7.el7                                                epel                                      2.6 M
 llvm5.0-libs                                             x86_64                                   5.0.1-7.el7                                                epel                                       13 M
 perl                                                     x86_64                                   4:5.16.3-294.el7_6                                         updates                                   8.0 M
 perl-Carp                                                noarch                                   1.26-244.el7                                               base                                       19 k
 perl-Encode                                              x86_64                                   2.51-7.el7                                                 base                                      1.5 M
 perl-Exporter                                            noarch                                   5.68-3.el7                                                 base                                       28 k
 perl-File-Path                                           noarch                                   2.09-2.el7                                                 base                                       26 k
 perl-File-Temp                                           noarch                                   0.23.01-3.el7                                              base                                       56 k
 perl-Filter                                              x86_64                                   1.49-3.el7                                                 base                                       76 k
 perl-Getopt-Long                                         noarch                                   2.40-3.el7                                                 base                                       56 k
 perl-HTTP-Tiny                                           noarch                                   0.033-3.el7                                                base                                       38 k
 perl-PathTools                                           x86_64                                   3.40-5.el7                                                 base                                       82 k
 perl-Pod-Escapes                                         noarch                                   1:1.04-294.el7_6                                           updates                                    51 k
 perl-Pod-Perldoc                                         noarch                                   3.20-4.el7                                                 base                                       87 k
 perl-Pod-Simple                                          noarch                                   1:3.28-4.el7                                               base                                      216 k
 perl-Pod-Usage                                           noarch                                   1.63-3.el7                                                 base                                       27 k
 perl-Scalar-List-Utils                                   x86_64                                   1.27-248.el7                                               base                                       36 k
 perl-Socket                                              x86_64                                   2.010-4.el7                                                base                                       49 k
 perl-Storable                                            x86_64                                   2.45-3.el7                                                 base                                       77 k
 perl-Text-ParseWords                                     noarch                                   3.29-4.el7                                                 base                                       14 k
 perl-Time-HiRes                                          x86_64                                   4:1.9725-3.el7                                             base                                       45 k
 perl-Time-Local                                          noarch                                   1.2300-2.el7                                               base                                       24 k
 perl-constant                                            noarch                                   1.27-2.el7                                                 base                                       19 k
 perl-libs                                                x86_64                                   4:5.16.3-294.el7_6                                         updates                                   688 k
 perl-macros                                              x86_64                                   4:5.16.3-294.el7_6                                         updates                                    44 k
 perl-parent                                              noarch                                   1:0.225-244.el7                                            base                                       12 k
 perl-podlators                                           noarch                                   2.5.1-3.el7                                                base                                      112 k
 perl-threads                                             x86_64                                   1.87-4.el7                                                 base                                       49 k
 perl-threads-shared                                      x86_64                                   1.43-6.el7                                                 base                                       39 k
 tcl                                                      x86_64                                   1:8.5.13-8.el7                                             base                                      1.9 M
 unixODBC                                                 x86_64                                   2.3.1-11.el7                                               base                                      413 k

Transaction Summary
==============================================================================================================================================================================================================
Install  14 Packages (+34 Dependent packages)

Total size: 73 M
Total download size: 71 M
Installed size: 248 M
Downloading packages:
(1/46): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm                                                                                                                                         |  49 kB  00:00:00     
(2/46): libxslt-1.1.28-5.el7.x86_64.rpm                                                                                                                                                | 242 kB  00:00:00     
(3/46): perl-Carp-1.26-244.el7.noarch.rpm                                                                                                                                              |  19 kB  00:00:00     
(4/46): llvm5.0-5.0.1-7.el7.x86_64.rpm                                                                                                                                                 | 2.6 MB  00:00:00     
(5/46): perl-Encode-2.51-7.el7.x86_64.rpm                                                                                                                                              | 1.5 MB  00:00:00     
(6/46): libicu-devel-50.1.2-17.el7.x86_64.rpm                                                                                                                                          | 702 kB  00:00:01     
(7/46): perl-Exporter-5.68-3.el7.noarch.rpm                                                                                                                                            |  28 kB  00:00:00     
(8/46): perl-File-Path-2.09-2.el7.noarch.rpm                                                                                                                                           |  26 kB  00:00:00     
(9/46): perl-File-Temp-0.23.01-3.el7.noarch.rpm                                                                                                                                        |  56 kB  00:00:00     
(10/46): perl-Filter-1.49-3.el7.x86_64.rpm                                                                                                                                             |  76 kB  00:00:00     
(11/46): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm                                                                                                                                         |  38 kB  00:00:00     
(12/46): perl-PathTools-3.40-5.el7.x86_64.rpm                                                                                                                                          |  82 kB  00:00:00     
(13/46): perl-Getopt-Long-2.40-3.el7.noarch.rpm                                                                                                                                        |  56 kB  00:00:00     
(14/46): perl-Pod-Simple-3.28-4.el7.noarch.rpm                                                                                                                                         | 216 kB  00:00:00     
(15/46): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm                                                                                                                                        |  87 kB  00:00:00     
(16/46): perl-Pod-Usage-1.63-3.el7.noarch.rpm                                                                                                                                          |  27 kB  00:00:00     
(17/46): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm                                                                                                                                |  36 kB  00:00:00     
(18/46): perl-Socket-2.010-4.el7.x86_64.rpm                                                                                                                                            |  49 kB  00:00:00     
(19/46): perl-Text-ParseWords-3.29-4.el7.noarch.rpm                                                                                                                                    |  14 kB  00:00:00     
(20/46): perl-Storable-2.45-3.el7.x86_64.rpm                                                                                                                                           |  77 kB  00:00:00     
(21/46): perl-Pod-Escapes-1.04-294.el7_6.noarch.rpm                                                                                                                                    |  51 kB  00:00:00     
(22/46): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm                                                                                                                                       |  45 kB  00:00:00     
(23/46): perl-Time-Local-1.2300-2.el7.noarch.rpm                                                                                                                                       |  24 kB  00:00:00     
(24/46): perl-constant-1.27-2.el7.noarch.rpm                                                                                                                                           |  19 kB  00:00:00     
(25/46): perl-macros-5.16.3-294.el7_6.x86_64.rpm                                                                                                                                       |  44 kB  00:00:00     
(26/46): perl-libs-5.16.3-294.el7_6.x86_64.rpm                                                                                                                                         | 688 kB  00:00:00     
(27/46): perl-parent-0.225-244.el7.noarch.rpm                                                                                                                                          |  12 kB  00:00:00     
(28/46): perl-threads-1.87-4.el7.x86_64.rpm                                                                                                                                            |  49 kB  00:00:00     
(29/46): perl-threads-shared-1.43-6.el7.x86_64.rpm                                                                                                                                     |  39 kB  00:00:00     
(30/46): perl-podlators-2.5.1-3.el7.noarch.rpm                                                                                                                                         | 112 kB  00:00:00     
(31/46): llvm5.0-libs-5.0.1-7.el7.x86_64.rpm                                                                                                                                           |  13 MB  00:00:04     
(32/46): perl-5.16.3-294.el7_6.x86_64.rpm                                                                                                                                              | 8.0 MB  00:00:07     
(33/46): postgresql11-contrib-11.2-2PGDG.rhel7.x86_64.rpm                                                                                                                              | 616 kB  00:00:08     
(34/46): postgresql11-devel-11.2-2PGDG.rhel7.x86_64.rpm                                                                                                                                | 2.0 MB  00:00:05     
(35/46): postgresql11-debuginfo-11.2-2PGDG.rhel7.x86_64.rpm                                                                                                                            |  10 MB  00:00:27     
(36/46): postgresql11-docs-11.2-2PGDG.rhel7.x86_64.rpm                                                                                                                                 |  11 MB  00:00:23     
(37/46): postgresql11-odbc-11.00.0000-1PGDG.rhel7.x86_64.rpm                                                                                                                           | 283 kB  00:00:02     
(38/46): postgresql11-plperl-11.2-2PGDG.rhel7.x86_64.rpm                                                                                                                               |  61 kB  00:00:00     
(39/46): postgresql11-plpython-11.2-2PGDG.rhel7.x86_64.rpm                                                                                                                             |  82 kB  00:00:00     
(40/46): postgresql11-pltcl-11.2-2PGDG.rhel7.x86_64.rpm                                                                                                                                |  39 kB  00:00:00     
(41/46): postgresql11-llvmjit-11.2-2PGDG.rhel7.x86_64.rpm                                                                                                                              | 9.0 MB  00:00:19     
(42/46): postgresql11-tcl-2.4.0-2.rhel7.1.x86_64.rpm                                                                                                                                   | 309 kB  00:00:00     
(43/46): postgresql11-test-11.2-2PGDG.rhel7.x86_64.rpm                                                                                                                                 | 1.7 MB  00:00:03     
(44/46): tcl-8.5.13-8.el7.x86_64.rpm                                                                                                                                                   | 1.9 MB  00:00:04     
(45/46): unixODBC-2.3.1-11.el7.x86_64.rpm                                                                                                                                              | 413 kB  00:00:05     
(46/46): postgresql11-server-11.2-2PGDG.rhel7.x86_64.rpm                                                                                                                               | 4.7 MB  00:00:13     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                         1.2 MB/s |  71 MB  00:00:56     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : postgresql11-libs-11.2-2PGDG.rhel7.x86_64                                                                                                                                                 1/48 
  Installing : postgresql11-11.2-2PGDG.rhel7.x86_64                                                                                                                                                      2/48 
  Installing : postgresql11-server-11.2-2PGDG.rhel7.x86_64                                                                                                                                               3/48 
  Installing : llvm5.0-libs-5.0.1-7.el7.x86_64                                                                                                                                                           4/48 
  Installing : 1:tcl-8.5.13-8.el7.x86_64                                                                                                                                                                 5/48 
  Installing : llvm5.0-5.0.1-7.el7.x86_64                                                                                                                                                                6/48 
  Installing : 1:perl-parent-0.225-244.el7.noarch                                                                                                                                                        7/48 
  Installing : perl-HTTP-Tiny-0.033-3.el7.noarch                                                                                                                                                         8/48 
  Installing : perl-podlators-2.5.1-3.el7.noarch                                                                                                                                                         9/48 
  Installing : perl-Pod-Perldoc-3.20-4.el7.noarch                                                                                                                                                       10/48 
  Installing : 1:perl-Pod-Escapes-1.04-294.el7_6.noarch                                                                                                                                                 11/48 
  Installing : perl-Encode-2.51-7.el7.x86_64                                                                                                                                                            12/48 
  Installing : perl-Text-ParseWords-3.29-4.el7.noarch                                                                                                                                                   13/48 
  Installing : perl-Pod-Usage-1.63-3.el7.noarch                                                                                                                                                         14/48 
  Installing : 4:perl-libs-5.16.3-294.el7_6.x86_64                                                                                                                                                      15/48 
  Installing : 4:perl-macros-5.16.3-294.el7_6.x86_64                                                                                                                                                    16/48 
  Installing : perl-threads-1.87-4.el7.x86_64                                                                                                                                                           17/48 
  Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                                                                                                                                                    18/48 
  Installing : perl-Exporter-5.68-3.el7.noarch                                                                                                                                                          19/48 
  Installing : perl-constant-1.27-2.el7.noarch                                                                                                                                                          20/48 
  Installing : perl-Time-Local-1.2300-2.el7.noarch                                                                                                                                                      21/48 
  Installing : perl-Carp-1.26-244.el7.noarch                                                                                                                                                            22/48 
  Installing : perl-Storable-2.45-3.el7.x86_64                                                                                                                                                          23/48 
  Installing : perl-threads-shared-1.43-6.el7.x86_64                                                                                                                                                    24/48 
  Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch                                                                                                                                                      25/48 
  Installing : perl-File-Path-2.09-2.el7.noarch                                                                                                                                                         26/48 
  Installing : perl-PathTools-3.40-5.el7.x86_64                                                                                                                                                         27/48 
  Installing : perl-File-Temp-0.23.01-3.el7.noarch                                                                                                                                                      28/48 
  Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64                                                                                                                                               29/48 
  Installing : perl-Filter-1.49-3.el7.x86_64                                                                                                                                                            30/48 
  Installing : perl-Socket-2.010-4.el7.x86_64                                                                                                                                                           31/48 
  Installing : perl-Getopt-Long-2.40-3.el7.noarch                                                                                                                                                       32/48 
  Installing : 4:perl-5.16.3-294.el7_6.x86_64                                                                                                                                                           33/48 
  Installing : libicu-devel-50.1.2-17.el7.x86_64                                                                                                                                                        34/48 
  Installing : postgresql11-devel-11.2-2PGDG.rhel7.x86_64                                                                                                                                               35/48 
  Installing : libxslt-1.1.28-5.el7.x86_64                                                                                                                                                              36/48 
  Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64                                                                                                                                                       37/48 
  Installing : unixODBC-2.3.1-11.el7.x86_64                                                                                                                                                             38/48 
  Installing : postgresql11-odbc-11.00.0000-1PGDG.rhel7.x86_64                                                                                                                                          39/48 
  Installing : postgresql11-contrib-11.2-2PGDG.rhel7.x86_64                                                                                                                                             40/48 
  Installing : postgresql11-test-11.2-2PGDG.rhel7.x86_64                                                                                                                                                41/48 
  Installing : postgresql11-plperl-11.2-2PGDG.rhel7.x86_64                                                                                                                                              42/48 
  Installing : postgresql11-llvmjit-11.2-2PGDG.rhel7.x86_64                                                                                                                                             43/48 
  Installing : postgresql11-pltcl-11.2-2PGDG.rhel7.x86_64                                                                                                                                               44/48 
  Installing : postgresql11-tcl-2.4.0-2.rhel7.1.x86_64                                                                                                                                                  45/48 
  Installing : postgresql11-plpython-11.2-2PGDG.rhel7.x86_64                                                                                                                                            46/48 
  Installing : postgresql11-docs-11.2-2PGDG.rhel7.x86_64                                                                                                                                                47/48 
  Installing : postgresql11-debuginfo-11.2-2PGDG.rhel7.x86_64                                                                                                                                           48/48 
  Verifying  : postgresql11-libs-11.2-2PGDG.rhel7.x86_64                                                                                                                                                 1/48 
  Verifying  : perl-HTTP-Tiny-0.033-3.el7.noarch                                                                                                                                                         2/48 
  Verifying  : 1:tcl-8.5.13-8.el7.x86_64                                                                                                                                                                 3/48 
  Verifying  : postgresql11-llvmjit-11.2-2PGDG.rhel7.x86_64                                                                                                                                              4/48 
  Verifying  : perl-threads-shared-1.43-6.el7.x86_64                                                                                                                                                     5/48 
  Verifying  : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                                                                                                                                                     6/48 
  Verifying  : 1:perl-Pod-Escapes-1.04-294.el7_6.noarch                                                                                                                                                  7/48 
  Verifying  : perl-threads-1.87-4.el7.x86_64                                                                                                                                                            8/48 
  Verifying  : perl-Exporter-5.68-3.el7.noarch                                                                                                                                                           9/48 
  Verifying  : perl-constant-1.27-2.el7.noarch                                                                                                                                                          10/48 
  Verifying  : perl-PathTools-3.40-5.el7.x86_64                                                                                                                                                         11/48 
  Verifying  : postgresql11-contrib-11.2-2PGDG.rhel7.x86_64                                                                                                                                             12/48 
  Verifying  : 1:perl-parent-0.225-244.el7.noarch                                                                                                                                                       13/48 
  Verifying  : 4:perl-libs-5.16.3-294.el7_6.x86_64                                                                                                                                                      14/48 
  Verifying  : perl-Encode-2.51-7.el7.x86_64                                                                                                                                                            15/48 
  Verifying  : perl-File-Temp-0.23.01-3.el7.noarch                                                                                                                                                      16/48 
  Verifying  : 1:perl-Pod-Simple-3.28-4.el7.noarch                                                                                                                                                      17/48 
  Verifying  : libtool-ltdl-2.4.2-22.el7_3.x86_64                                                                                                                                                       18/48 
  Verifying  : perl-Time-Local-1.2300-2.el7.noarch                                                                                                                                                      19/48 
  Verifying  : postgresql11-debuginfo-11.2-2PGDG.rhel7.x86_64                                                                                                                                           20/48 
  Verifying  : perl-Pod-Perldoc-3.20-4.el7.noarch                                                                                                                                                       21/48 
  Verifying  : postgresql11-plpython-11.2-2PGDG.rhel7.x86_64                                                                                                                                            22/48 
  Verifying  : 4:perl-macros-5.16.3-294.el7_6.x86_64                                                                                                                                                    23/48 
  Verifying  : 4:perl-5.16.3-294.el7_6.x86_64                                                                                                                                                           24/48 
  Verifying  : perl-File-Path-2.09-2.el7.noarch                                                                                                                                                         25/48 
  Verifying  : perl-Carp-1.26-244.el7.noarch                                                                                                                                                            26/48 
  Verifying  : postgresql11-devel-11.2-2PGDG.rhel7.x86_64                                                                                                                                               27/48 
  Verifying  : postgresql11-pltcl-11.2-2PGDG.rhel7.x86_64                                                                                                                                               28/48 
  Verifying  : unixODBC-2.3.1-11.el7.x86_64                                                                                                                                                             29/48 
  Verifying  : libxslt-1.1.28-5.el7.x86_64                                                                                                                                                              30/48 
  Verifying  : perl-Storable-2.45-3.el7.x86_64                                                                                                                                                          31/48 
  Verifying  : postgresql11-odbc-11.00.0000-1PGDG.rhel7.x86_64                                                                                                                                          32/48 
  Verifying  : perl-Scalar-List-Utils-1.27-248.el7.x86_64                                                                                                                                               33/48 
  Verifying  : postgresql11-test-11.2-2PGDG.rhel7.x86_64                                                                                                                                                34/48 
  Verifying  : llvm5.0-5.0.1-7.el7.x86_64                                                                                                                                                               35/48 
  Verifying  : perl-Pod-Usage-1.63-3.el7.noarch                                                                                                                                                         36/48 
  Verifying  : postgresql11-11.2-2PGDG.rhel7.x86_64                                                                                                                                                     37/48 
  Verifying  : postgresql11-docs-11.2-2PGDG.rhel7.x86_64                                                                                                                                                38/48 
  Verifying  : perl-podlators-2.5.1-3.el7.noarch                                                                                                                                                        39/48 
  Verifying  : postgresql11-plperl-11.2-2PGDG.rhel7.x86_64                                                                                                                                              40/48 
  Verifying  : llvm5.0-libs-5.0.1-7.el7.x86_64                                                                                                                                                          41/48 
  Verifying  : libicu-devel-50.1.2-17.el7.x86_64                                                                                                                                                        42/48 
  Verifying  : perl-Filter-1.49-3.el7.x86_64                                                                                                                                                            43/48 
  Verifying  : perl-Getopt-Long-2.40-3.el7.noarch                                                                                                                                                       44/48 
  Verifying  : perl-Text-ParseWords-3.29-4.el7.noarch                                                                                                                                                   45/48 
  Verifying  : perl-Socket-2.010-4.el7.x86_64                                                                                                                                                           46/48 
  Verifying  : postgresql11-tcl-2.4.0-2.rhel7.1.x86_64                                                                                                                                                  47/48 
  Verifying  : postgresql11-server-11.2-2PGDG.rhel7.x86_64                                                                                                                                              48/48 

Installed:
  postgresql11.x86_64 0:11.2-2PGDG.rhel7           postgresql11-contrib.x86_64 0:11.2-2PGDG.rhel7     postgresql11-debuginfo.x86_64 0:11.2-2PGDG.rhel7    postgresql11-devel.x86_64 0:11.2-2PGDG.rhel7        
  postgresql11-docs.x86_64 0:11.2-2PGDG.rhel7      postgresql11-libs.x86_64 0:11.2-2PGDG.rhel7        postgresql11-llvmjit.x86_64 0:11.2-2PGDG.rhel7      postgresql11-odbc.x86_64 0:11.00.0000-1PGDG.rhel7   
  postgresql11-plperl.x86_64 0:11.2-2PGDG.rhel7    postgresql11-plpython.x86_64 0:11.2-2PGDG.rhel7    postgresql11-pltcl.x86_64 0:11.2-2PGDG.rhel7        postgresql11-server.x86_64 0:11.2-2PGDG.rhel7       
  postgresql11-tcl.x86_64 0:2.4.0-2.rhel7.1        postgresql11-test.x86_64 0:11.2-2PGDG.rhel7       

Dependency Installed:
  libicu-devel.x86_64 0:50.1.2-17.el7              libtool-ltdl.x86_64 0:2.4.2-22.el7_3            libxslt.x86_64 0:1.1.28-5.el7                       llvm5.0.x86_64 0:5.0.1-7.el7                           
  llvm5.0-libs.x86_64 0:5.0.1-7.el7                perl.x86_64 4:5.16.3-294.el7_6                  perl-Carp.noarch 0:1.26-244.el7                     perl-Encode.x86_64 0:2.51-7.el7                        
  perl-Exporter.noarch 0:5.68-3.el7                perl-File-Path.noarch 0:2.09-2.el7              perl-File-Temp.noarch 0:0.23.01-3.el7               perl-Filter.x86_64 0:1.49-3.el7                        
  perl-Getopt-Long.noarch 0:2.40-3.el7             perl-HTTP-Tiny.noarch 0:0.033-3.el7             perl-PathTools.x86_64 0:3.40-5.el7                  perl-Pod-Escapes.noarch 1:1.04-294.el7_6               
  perl-Pod-Perldoc.noarch 0:3.20-4.el7             perl-Pod-Simple.noarch 1:3.28-4.el7             perl-Pod-Usage.noarch 0:1.63-3.el7                  perl-Scalar-List-Utils.x86_64 0:1.27-248.el7           
  perl-Socket.x86_64 0:2.010-4.el7                 perl-Storable.x86_64 0:2.45-3.el7               perl-Text-ParseWords.noarch 0:3.29-4.el7            perl-Time-HiRes.x86_64 4:1.9725-3.el7                  
  perl-Time-Local.noarch 0:1.2300-2.el7            perl-constant.noarch 0:1.27-2.el7               perl-libs.x86_64 4:5.16.3-294.el7_6                 perl-macros.x86_64 4:5.16.3-294.el7_6                  
  perl-parent.noarch 1:0.225-244.el7               perl-podlators.noarch 0:2.5.1-3.el7             perl-threads.x86_64 0:1.87-4.el7                    perl-threads-shared.x86_64 0:1.43-6.el7                
  tcl.x86_64 1:8.5.13-8.el7                        unixODBC.x86_64 0:2.3.1-11.el7                 

Complete!

三、创建用户和数据目录

#新增postgres用户:
useradd -m postgres

#修改postgres用户密码:passwd postgres(这里设置密码为postgres)
passwd postgres  --修改postgres用户密码

mkdir -p /data/pg11data  
chmod 700 /data/pg11data
chown postgres:postgres /data/pg11data

四、初始化数据库

数据目录在 /data/pg11data

使用postgresql-11-setup 初始化数据库

vi /usr/lib/systemd/system/postgresql-11.service
把Environment=PGDATA=/var/lib/pgsql/11/data/修改为Environment=PGDATA=/data/pg11data/

/usr/pgsql-11/bin/postgresql-11-setup initdb   #初始化
systemctl enable postgresql-11                 #设置开机启动    
systemctl start postgresql-11                  #启动postgresql服务 

登录postgresql并设置密码
设置用户 postgres 密码 postgres

su - postgres
psql
ALTER USER postgres WITH PASSWORD 'postgres';

数据库登录权限设置
开启远程访问

vi /data/pg11data/postgresql.conf 
修改#listen_addresses = ‘localhost’ 为 listen_addresses=’*’ 
当然,此处‘*’也可以改为任何你想开放的服务器IP

如有需要修改端口

vi/data/pg11data/postgresql.conf 
修改#port =5432 为 port =端口

信任远程连接

vi /data/pg11data/pg_hba.conf 
修改如下内容,信任指定服务器连接 
# IPv4 local connections: 
host    all             all             127.0.0.1/32            trust
host    all             all             0.0.0.0/0            password

打开防火墙
CentOS 防火墙中内置了PostgreSQL服务,配置文件位置在/usr/lib/firewalld/services/postgresql.xml,我们只需以服务方式将PostgreSQL服务开放即可。

 #开机启用防火墙
systemctl enable firewalld

 #开启防火墙
systemctl start firewalld

#开放postgresql服务
firewall-cmd --add-service=postgresql --permanent 

#或者可以直接添加端口
firewall-cmd --zone=public --add-port=5432/tcp --permanent 

#重载防火墙
firewall-cmd --reload  

#查看占用端口
firewall-cmd --list-ports 

五、测试使用

因为postgres属于superuser,我们需要创建部分低权限用户

创建数据库

CREATE DATABASE testdb;
创建用户

CREATE USER testuser CREATEDB LOGIN PASSWORD 'testpassword';
将testdb所有权限赋给用户testuser

GRANT ALL ON DATABASE testdb TO testuser;

删除数据库

drop database testdb;

删除用户

drop role testuser;

打开JIT开关

postgres=# set jit=on;   
SET
postgres=#  select name,setting from pg_settings where name like 'jit%'; 
          name           | setting 
-------------------------+---------
 jit                     | on
 jit_above_cost          | 100000
 jit_debugging_support   | off
 jit_dump_bitcode        | off
 jit_expressions         | on
 jit_inline_above_cost   | 500000
 jit_optimize_above_cost | 500000
 jit_profiling_support   | off
 jit_provider            | llvmjit
 jit_tuple_deforming     | on
(10 rows)

创建测试数据:

postgres=# create table ttt (a int, b text, c date );                                                                        
CREATE TABLE
postgres=#  insert into ttt (a,b,c) select aa.*, md5(aa::text), now() from generate_series(1,10000000) aa; 
INSERT 0 10000000

JIT对比测试

postgres=# set jit_above_cost=5;
SET
postgres=# set jit_inline_above_cost=5;
SET
postgres=# set jit_optimize_above_cost=5;
SET
postgres=# set jit=off; 
SET
postgres=# explain analyze select sum(a) from ttt;
                                                                QUERY PLAN                                                                 
-------------------------------------------------------------------------------------------------------------------------------------------
 Finalize Aggregate  (cost=152869.47..152869.48 rows=1 width=8) (actual time=892.107..892.107 rows=1 loops=1)
   ->  Gather  (cost=152869.25..152869.46 rows=2 width=8) (actual time=891.985..896.537 rows=3 loops=1)
         Workers Planned: 2
         Workers Launched: 2
         ->  Partial Aggregate  (cost=151869.25..151869.26 rows=1 width=8) (actual time=882.116..882.116 rows=1 loops=3)
               ->  Parallel Seq Scan on ttt  (cost=0.00..140187.00 rows=4672900 width=4) (actual time=0.044..672.966 rows=3333333 loops=3)
 Planning Time: 0.247 ms
 Execution Time: 896.620 ms
(8 rows)

postgres=# set jit=on;                             
SET
postgres=# explain analyze select sum(a) from ttt;                                                         
                                                                QUERY PLAN                                                                 
-------------------------------------------------------------------------------------------------------------------------------------------
 Finalize Aggregate  (cost=152869.47..152869.48 rows=1 width=8) (actual time=569.741..569.741 rows=1 loops=1)
   ->  Gather  (cost=152869.25..152869.46 rows=2 width=8) (actual time=569.603..575.069 rows=3 loops=1)
         Workers Planned: 2
         Workers Launched: 2
         ->  Partial Aggregate  (cost=151869.25..151869.26 rows=1 width=8) (actual time=552.531..552.532 rows=1 loops=3)
               ->  Parallel Seq Scan on ttt  (cost=0.00..140187.00 rows=4672900 width=4) (actual time=0.046..325.320 rows=3333333 loops=3)
 Planning Time: 0.094 ms
 JIT:
   Functions: 12
   Options: Inlining true, Optimization true, Expressions true, Deforming true
   Timing: Generation 7.794 ms, Inlining 132.070 ms, Optimization 56.825 ms, Emission 33.292 ms, Total 229.981 ms
 Execution Time: 576.655 ms
(12 rows)

你可能感兴趣的:(centos7 在线安装新版pg11+ llvm jit)