源码安装postgresql14.12版本

一.环境准备:

cpu4核,内存8G,硬盘50G

  • 拉取安装包,这里使用的是14.12版本

[root@localhost ~]# postgresql-14.12.tar.bz2

二.安装本地yum源

2.1.连接公网IP

#Linux执行如下语句1:


[root@localhost ~]# vi /etc/resolv.conf
[root@localhost ~]# cat /etc/resolv.conf
nameserver 202.103.24.68   


2.2.配置centos7官方源

[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo

#下载yum文件后显示:

https://mirrors.aliyun.com/repo/Centos-7.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2523  100  2523    0     0  11092      0 --:--:-- --:--:-- --:--:-- 11114

[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
[root@localhost ~]# yum repolist all

三.解压包,安装依赖

3.1.安装解压工具

#Linux执行如下语句2:

[root@localhost ~]# yum -y install bzip2
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Package bzip2-1.0.6-13.el7.x86_64 already installed and latest version
Nothing to do

#这里显示已安装并且已是最新版本

3.2.解包

#Linux执行如下语句3:

[root@localhost ~]# bunzip2 postgresql-14.12.tar.bz2
[root@localhost ~]# ll
total 144976
-rw-------. 1 root root      1326 Jun 12  2023 anaconda-ks.cfg
-rw-r--r--. 1 root root 148449280 May 31 11:41 postgresql-14.12.tar
[root@localhost ~]# tar -xf postgresql-14.12.tar
[root@localhost ~]# ll
total 144980
-rw-------. 1 root root      1326 Jun 12  2023 anaconda-ks.cfg
drwxrwxrwx. 6 1107 1107      4096 May  7 04:39 postgresql-14.12
-rw-r--r--. 1 root root 148449280 May 31 11:41 postgresql-14.12.tar

3.3.安装依赖

#Linux执行如下语句4:

[root@localhost ~]# yum install -y readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python3-devel gcc-c++ openssl-devel cmake

3.4.创建文件夹,移动安装目录

#Linux执行如下语句5:

[root@localhost ~]# mkdir /soft

[root@localhost ~]# mv postgresql-14.12 /soft

3.5.进入解压后的文件夹

#Linux执行如下语句6:

[root@localhost ~]# cd /soft/postgresql-14.12/
[root@localhost postgresql-14.12]# ls
aclocal.m4  configure     contrib    doc             HISTORY  Makefile  src
config      configure.ac  COPYRIGHT  GNUmakefile.in  INSTALL  README

四.创目录,编译

4.1.创建目录,编译源码

#Linux执行如下语句7:

[root@localhost postgresql-14.12]# mkdir -p /opt/pgsql/postgresql
[root@localhost postgresql-14.12]# ./configure --prefix=/opt/pgsql/postgresql/

#编译后的显示:
...

configure: using CPPFLAGS= -D_GNU_SOURCE 
configure: using LDFLAGS=  -Wl,--as-needed
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/include/pg_config_ext.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking src/backend/port/posix_sema.c to src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port

4.1.1.编译

#Linux执行如下语句8:

make

#编译后的显示:
...

make -C ../../../src/common all
make[4]: Entering directory '/soft/postgresql-14.12/src/common'
make[4]: Nothing to be done for 'all'.
mak
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值