1.获取源码
从PostgreSQL: File Browser获取tar.bz2或者tar.gz源码
2.解压
tar xf postgresql-version.tar.bz2
root@hwz-VMware-Virtual-Platform:/usr/local# tar xf postgresql-16.6.tar.bz2
root@hwz-VMware-Virtual-Platform:/usr/local# ll
总计 24324
drwxr-xr-x 12 root root 4096 2月 6 11:35 ./
drwxr-xr-x 12 root root 4096 10月 9 21:16 ../
drwxr-xr-x 2 root root 4096 10月 9 21:16 bin/
drwxr-xr-x 2 root root 4096 10月 9 21:16 etc/
drwxr-xr-x 2 root root 4096 10月 9 21:16 games/
drwxr-xr-x 2 root root 4096 10月 9 21:16 include/
drwxr-xr-x 3 root root 4096 10月 9 21:16 lib/
drwxr-xr-x 2 root root 4096 10月 9 21:16 libexec/
lrwxrwxrwx 1 root root 9 10月 9 21:16 man -> share/man/
drwxrwxrwx 6 1107 1107 4096 11月 19 04:48 postgresql-16.6/
-rw-r--r-- 1 root root 24856956 2月 6 11:34 postgresql-16.6.tar.bz2
drwxr-xr-x 2 root root 4096 10月 9 21:16 sbin/
drwxr-xr-x 7 root root 4096 10月 9 21:19 share/
drwxr-xr-x 2 root root 4096 10月 9 21:16 src/
3.编译构建程序
root@hwz-VMware-Virtual-Platform:/usr/local# cd postgresql-16.6/
root@hwz-VMware-Virtual-Platform:/usr/local/postgresql-16.6# ./configure --prefix=/usr/local/pgsql16
可能会缺少库,按需安装即可
make&make install
编译后生成目录
root@hwz-VMware-Virtual-Platform:/usr/local/pgsql16# ll
总计 24
drwxr-xr-x 6 root root 4096 2月 7 09:04 ./
drwxr-xr-x 13 root root 4096 2月 7 09:04 ../
drwxr-xr-x 2 root root 4096 2月 7 09:04 bin/
drwxr-xr-x 6 root root 4096 2月 7 09:04 include/
drwxr-xr-x 4 root root 4096 2月 7 09:04 lib/
drwxr-xr-x 6 root root 4096 2月 7 09:04 share/