1. 安装PostgreSQL的repository RPM
访问PostgreSQL官方主页https://www.postgresql.org/download/的下载区选择你的服务器操作系统,由于我用的是CentOS7,所以这里我选择Linux CentOS;进入链接页面后,Select version选择12,Select platform选择CentOS7,Select architecture选择x86_64,选择完成后页面会动态输出安装命令,执行安装命令安装PostgreSQL的repository RPM:
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
执行结束后,在/etc/yum.repos.d目录中可以看到名称为pgdg-redhat-all.repo的源配置文件。
2. 安装PostgreSQL
安装完PostgreSQL的repository RPM后,通过yum的search命令可以看到有很多postgresql12的包:
yum search postgresql12
postgresql12-odbc-debuginfo.x86_64 : Debug information for package postgresql12-odbc
postgresql12.x86_64 : PostgreSQL client programs and libraries
postgresql12-contrib.x86_64 : Contributed source and binaries distributed with PostgreSQL
postgresql12-devel.x86_64 : PostgreSQL development header files and libraries
postgresql12-docs.x86_64 : Extra documentation for PostgreSQL
postgresql12-libs.x86_64 : The shared libraries required for any PostgreSQL clients
postgresql12-llvmjit.x86_64 : Just-in-time compilation support for PostgreSQL
postgresql12-odbc.x86_64 : PostgreSQL ODBC driver
postgresql12-plperl.x86_64 : The Perl procedural language for PostgreSQL
postgresql12-plpython.x86_64 : The Python procedural language for PostgreSQL
postgresql12-plpython3.x86_64 : The Python3 procedural language for PostgreSQL
postgresql12-pltcl.x86_64 : The Tcl procedural language for PostgreSQL
postgresql12-server.x86_64 : The programs needed to create and run a PostgreSQL server
postgresql12-tcl.x86_64 : A Tcl client library for PostgreSQL
postgresql12-test.x86_64 : The test suite distributed with PostgreSQL
其中: