安装前环境准备
- make—4.2.1(至少3.8)
- gmake—4.2.1(至少3.8)
- gcc—8.3.1
- tar—1.30
- readline
- zlib
创建postgres用户组和用户
[root@CentOS /]# groupadd postgres
[root@CentOS /]# useradd -g postgres postgres
[root@CentOS /]# passwd postgres
Changing password for user postgres.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
创建安装路径并授权给postgres
-P表示递归创建。
[root@CentOS ~]# mkdir -p /data/postgres/10.14/
[root@CentOS ~]# chown -R postgres:postgres /data/
[root@CentOS ~]# ll /data/
total 0
drwxr-xr-x 3 postgres postgres 18 May 9 11:41 postgres
获取官方源码
官方路径:https://www.postgresql.org/ftp/source/v10.0/
在对应gz上右键复制链接地址。例如PostgreSQL10.14的链接地址为:https://ftp.postgresql.org/pub/source/v10.14/postgresql-10.14.tar.gz
[root@CentOS ~]# su - postgres
[postgres@CentOS ~]$ wget https://ftp.postgresql.org/pub/source/v10.14/postgresql-10.14.tar.gz
--2021-05-09 13:54:19-- https://ftp.postgresql.org/pub/source/v10.14/postgresql-10.14.tar.gz
Resolving ftp.postgresql.org (ftp.postgresql.org)... 147.75.85.69, 87.238.57.227, 72.32.157.246, ...
Connecting to ftp.postgresql.org (ftp.postgresql.org)|147.75.85.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25007394 (24M) [application/octet-stream]
Saving to: ‘postgresql-10.14.tar.gz’
postgresql-10.14.tar.gz 100%[====================================================