
文章目录
一、源码安装
1.1 下载并解压安装包
第一步:访问PostgreSQL官网
官网地址:https://www.postgresql.org/
第二步:点击Download进入下载页面。

第三步:点击Source进入源码包下载页面。

第四步:根据自己的版本需求选择相应版本的源码包
这里我们选择的是最新的16.1版本。

选择tar.gz压缩包
第五步:将下载后的压缩包上传到服务器上,并对压缩包进行解压。
注意:
1、如果实在互联网环境下,可以使用wget命令来进行下载。
[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目录下。
[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
进入到解压后的源码包下
[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

本文详细介绍了从源码安装PostgreSQL的过程,包括下载、依赖包安装、预编译、编译安装、用户和目录管理、环境变量设置、数据库初始化、服务注册、配置文件修改以及密码更改等内容。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



