[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
#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