一、源码安装
1.1 下载并解压安装包
第一步:访问PostgreSQL官网
官网地址:https://www.postgresql.org/
第二步:点击Download进入下载页面。 第三步:点击Source进入源码包下载页面。
第四步:根据自己的版本需求选择相应版本的源码包
这里我们选择的是最新的16.1版本。
选择tar.gz压缩包
第五步:将下载后的压缩包上传到服务器上,并对压缩包进行解压。
注意:
1、如果实在互联网环境下,可以使用wget命令来进行下载。
shell [root@VM-16-10-centos opt]# wget https://ftp.postgresql.org/pub/source/v16.1/postgresql-16.1.tar.gz --no-check-certificate
2、这里我们是存在于/opt目录下。
```shell [root@VM-16-10-centos opt]# pwd /opt [root@VM-16-10-centos opt]# ll total 31684 drwxr-xr-x 4 root root 4096 Jan 14 18:27 mellanox -rw-r--r-- 1 root root 32433767 Nov 7 06:19 postgresql-16.1.tar.gz drwxr-xr-x. 2 root root 4096 Oct 31 2018 rh
解压PostgreSQL源码包
[root@VM-16-10-centos opt]# tar -zxvf postgresql-16.1.tar.gz [root@VM-16-10-centos opt]# ll total 31688 drwxr-xr-x 4 root root 4096 Jan 14 18:27 mellanox drwxrwxrwx 6 1107 1107 4096 Nov 7 06:18 postgresql-16.1 # 这就是我们需要的解压之后的源码包 -rw-r--r-- 1 root root 32433767 Nov 7 06:19 postgresql-16.1.tar.gz drwxr-xr-x. 2 root root 4096 Oct 31 2018 rh ```
进入到解压后的源码包下
shell [root@VM-16-10-centos opt]# cd postgresql-16.1/ [root@VM-16-10-centos postgresql-16.1]# ll total 876 -rw-r--r-- 1 1107 1107 365 Nov 7 06:04 aclocal.m4 drwxrwxrwx 2 1107 1107 4096 Nov 7 06:17 config -rwxr-xr-x 1 1107 1107 584560 Nov 7 06:04 configure -rw-r--r-- 1 1107 1107 87292 Nov 7 06:04 configure.ac drwxrwxrwx 61 1107 1107 4096 Nov 7 06:17 contrib -rw-r--r-- 1 1107 1107 1192 Nov 7 06:04 COPYRIGHT drwxrwxrwx 3 1107 1107 4096 Nov 7 06:17 doc -rw-r--r-- 1 1107 1107 4288 Nov 7 06:04 GNUmakefile.in -rw-r--r-- 1 1107 1107 277 Nov 7 06:04 HISTORY -rw-r--r-- 1 1107 1107 64601 Nov 7 06:18 INSTALL -rw-r--r-- 1 1107 1107 1875 Nov 7 06:04 Makefile -rw-r--r-- 1 1107 1107 102017 Nov 7 06:17 meson.build -rw-r--r-- 1 1107 1107 6266 Nov 7 06:04 meson_options.txt -rw-r--r-- 1 1107 1107 1213 Nov 7 06:04 README drwxrwxrwx 16 1107 1107 4096 Nov 7 06:18 src
解释一下源码包中内容各自的作用:
aclocal.m4:该文件包含在构建过程中由
autoconf
工具使用的宏。这些宏有助于配置构建环境。 config:这个目录包含在构建过程中使用的配置文件和脚本。
configure:这是由
autoconf
工具生成的可执行脚本。用于配置源代码以适应目标系统。 configur