快速且靠谱的简单安装 PostgreSQL 15 yum 安装postgis3.3

快速且靠谱的简单安装 PostgreSQL 15 yum 安装postgis3.3

  • 1、确保已经安装了PostgreSQL数据库。
  • 2、添加PostGIS的EPEL仓库
  • 3、使用YUM安装PostGIS
  • 4、以下为其他安装方式,一个个去找源码的编译安装,过程较为繁琐(不熟路的不推荐)

要在基于RPM的系统(如CentOS或RHEL)上使用yum安装PostGIS 3.3,需要确保有正确的仓库配置以及所有必需的依赖项。
以下是安装PostGIS的步骤:

1、确保已经安装了PostgreSQL数据库。

如果还未安装 PostgreSQL 15,可以按照以下步骤进行操作:

  1. 添加 PostgreSQL Yum 仓库
    首先,需要添加 PostgreSQL 的官方 Yum 仓库。可以使用以下命令:

    sudo yum install -y https://download.postgresql.org/pub/repos/yum/15/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
    

    请根据您的操作系统版本(如 RHEL 8 或 CentOS 8)调整 URL。

    或者

sudo yum install epel-release
sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-`rpm -E %{rhel}`-x86_64/pgdg-redhat-repo-latest.noarch.rpm

替换rpm -E %{rhel}为您的CentOS/RHEL版本号,例如7或8。

  1. 禁用默认的 PostgreSQL 模块(如果适用):
    在某些版本的 RHEL/CentOS 中,可能需要禁用默认的 PostgreSQL 模块:

    sudo dnf -y module disable postgresql
    
  2. 安装 PostgreSQL 15
    安装 PostgreSQL 15 及其相关工具:

    sudo yum install -y postgresql15 postgresql15-server
    
  3. 初始化数据库
    安装完成后,需要初始化数据库:

    sudo /usr/pgsql-15/bin/postgresql15-setup initdb
    
  4. 启动 PostgreSQL 服务
    启动 PostgreSQL 服务并设置为开机自启:

    sudo systemctl start postgresql-15
    sudo systemctl enable postgresql-15
    
  5. 检查 PostgreSQL 服务状态
    可以使用以下命令检查 PostgreSQL 服务的状态:

    sudo systemctl status postgresql-15
    

完成以上步骤后,已在系统上安装了 PostgreSQL 15。可以使用 psql 命令行工具连接到数据库并开始使用。

2、添加PostGIS的EPEL仓库

可以通过以下命令添加仓库:

sudo yum install epel-release
sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-`rpm -E %{rhel}`-x86_64/pgdg-redhat-repo-latest.noarch.rpm

替换rpm -E %{rhel}为您的CentOS/RHEL版本号,例如7或8。

创建一个YUM仓库文件以便能够安装PostGIS。

sudo vi /etc/yum.repos.d/PostGIS.repo

添加以下内容:

[PostGIS]
name = PostGIS Official Repository
baseurl = https://download.postgresql.org/pub/repos/yum/15/redhat/rhel-`rpm -E %{rhel}`-x86_64
enabled = 1
gpgcheck = 1
gpgkey = https://download.postgresql.org/pub/repos/yum/ACCC4CF8.gpg

替换rpm -E %{rhel}为您的CentOS/RHEL版本号。

3、使用YUM安装PostGIS

sudo yum install postgis33_15

注意:postgis33_15是PostGIS的包名,后面紧跟着的数字15表示它与PostgreSQL 15版本兼容。

一旦安装完成,则需要启用PostGIS扩展。
首先,登录到PostgreSQL:

psql -U postgres

然后,对于每个数据库启用PostGIS扩展:

CREATE EXTENSION postgis;

请确保替换步骤2中的版本号为您实际使用的CentOS/RHEL版本。
如果您使用的是PostgreSQL的不同主版本(例如14而不是15),您需要修改步骤3和步骤4中的仓库URL和包名称。

4、以下为其他安装方式,一个个去找源码的编译安装,过程较为繁琐(不熟路的不推荐)

操作系统为
CentOS Linux release 7.9.2009 (Core)
数据库为
postgresql 14.6


本文详细记录了在CentOS7.9系统上安装PostgreSQL14.6和PostGIS3.2.4的过程,包括环境准备、依赖包下载与安装、编译配置、错误排查以及数据库创建和加载PostGIS扩展的步骤。过程中遇到了如gcc、readline、zlib、libxml2、geos、proj、gdal、json-c、protobuf-c等依赖库的安装问题,并逐一解决。postgis 是 postgresql 的一个扩展插件,具有强大的空间计算功能,很适合用于地图系统。postgis 下载
登录 postgis 的官方网站:http://postgis.net/下载符合 postgresql 数据库版本的 postgis 安装包。本文档使用的版本为 3.2.4,查看该版本的使用文档,安装要求如下:包下载
经过多次尝试,最终整个环境包的版本使用情况如下:postgresql 14.6gcc 4.8.5make 3.82proj 8.2.1(新版本需要使用 cmake 进行编译安装)libxml2 2.9.9(新版本需要使用 cmake 进行编译安装)json-c 0.10(新版本需要使用 cmake 进行编译安装)gdal 3.5.3(新版本需要使用 cmake 进行编译安装)geos 3.6.6(新版本需要使用 cmake 进行编译安装)各安装包的下载地址:postgresqlPostgreSQL: File BrowsergccGCC Releases- GNU ProjectprojDownload — PROJ 9.5.0 documentationlibxml2Index of /sources/libxml2/json-cjson-c releasesgdalReleases · OSGeo/gdal · GitHubgeosDownload and Build | GEOScmake(如果使用的是proj等包的高级版本时可能需要)Download CMake安装 postgresql
1、创建安装用户[root@test ~]$ useradd postgres[root@test ~]$ passwd postgres2、上传安装包到执行目录[root@test ~]$ mkdir -p /opt/postgresql/soft[root@test ~]$ chown -R postgres:postgres /opt/postgresql[root@test ~]$ cd /opt/postgresql/soft[root@test soft]$ yum install lrzsz[root@test soft]$ rz[root@test soft]$ lspostgresql-14.6.tar.bz23、解压缩安装包,.bz2 格式解压需要安装 bzip2[root@test soft]$ yum install bzip2[root@test soft]$ tar -xvf postgresql-14.6.tar.bz24、开始安装[root@test soft]# cd postgresql-14.6[root@test postgresql-14.6]# lsaclocal.m4 config config.log configure configure.ac contrib COPYRIGHT doc GNUmakefile.in HISTORY INSTALL Makefile README src[root@test postgresql-14.6]# ./configurechecking build system type... x86_64-pc-linux-gnuchecking host system type... x86_64-pc-linux-gnuchecking which template to use... linuxchecking whether NLS is wanted... nochecking for default port number... 5432checking for block size... 8kBchecking for segment size... 1GBchecking for WAL block size... 8kBchecking for gcc... nochecking for cc... noconfigure: error: in `/opt/postgresql/soft/postgresql-14.6':configure: error: no acceptable C compiler found in $PATHSee `config.log' for more details报错很明显,没有找到 C 语言的编译器安装 gcc 之后继续安装[root@test postgresql-14.6]# yum install gcc[root@test postgresql-14.6]# ./configure......checking for library containing dlsym... -ldlchecking for library containing socket... none requiredchecking for library containing shl_load... nochecking for library containing getopt_long... none requiredchecking for library containing shm_open... -lrtchecking for library containing shm_unlink... none requiredchecking for library containing clock_gettime... none requiredchecking for library containing fdatasync... none requiredchecking for library containing shmget... none requiredchecking for library containing backtrace_symbols... none requiredchecking for library containing gethostbyname_r... none requiredchecking for library containing pthread_barrier_wait... -lpthreadchecking for library containing readline... noconfigure: error: readline library not foundIf you have readline already installed, see config.log for details on thefailure. It is possible the compiler isn't looking in the proper directory.Use --without-readline to disable readline support.报错显示为没有找到 readline 的库文件安装 readline-devel 包解决[root@test postgresql-14.6]# yum install readlineLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfilePackage readline-6.2-11.el7.x86_64 already installed and latest versionNothing to do[root@test postgresql-14.6]# yum install readline-devel.x86_64继续安装[root@test postgresql-14.6]# ./configure......checking for library containing readline... -lreadlinechecking for inflate in -lz... noconfigure: error: zlib library not foundIf you have zlib already installed, see config.log for details on thefailure. It is possible the compiler isn't looking in the proper directory.Use --without-zlib to disable zlib support.[root@test postgresql-14.6]# yum install zlibLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfilePackage zlib-1.2.7-20.el7_9.x86_64 already installed and latest versionNothing to do报错显示为没有找到 zlib 的库文件,同样安装 devel 包解决[root@test postgresql-14.6]# yum install zlib-devel.x86_64继续安装[postgres@test postgresql-14.6]$ ./configure --prefix=/usr/local/pgsql-14.6......configure: using LDFLAGS= -Wl,--as-neededconfigure: creating ./config.statusconfig.status: creating GNUmakefileconfig.status: creating src/Makefile.globalconfig.status: creating src/include/pg_config.h./config.status: line 1378: src/include/stamp-h: Permission deniedconfig.status: creating src/include/pg_config_ext.hconfig.status: src/include/pg_config_ext.h is unchanged./config.status: line 1382: src/include/stamp-ext-h: Permission deniedconfig.status: creating src/interfaces/ecpg/include/ecpg_config.hconfig.status: src/interfaces/ecpg/include/ecpg_config.h is unchanged./config.status: line 1384: src/interfaces/ecpg/include/stamp-h: Permission deniedconfig.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.sconfig.status: linking src/backend/port/posix_sema.c to src/backend/port/pg_sema.cconfig.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.cconfig.status: linking src/include/port/linux.h to src/include/pg_config_os.hconfig.status: linking src/makefiles/Makefile.linux to src/Makefile.port[postgres@test postgresql-14.6]$ exitlogout[root@test postgresql-14.6]# mkdir /usr/local/pgsql-14.6[root@test postgresql-14.6]# chown postgres:postgres /usr/local/pgsql-14.6/[root@test postgresql-14.6]# su - postgresLast login: Tue Feb 28 10:01:38 CST 2023 on pts/1[postgres@test ~]$ cd /opt/postgresql/soft/postgresql-14.6[postgres@test postgresql-14.6]$ make......gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 isolation_main.o pg_regress.o -L../../../src/port -L../../../src/common -Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql-14.6/lib',--enable-new-dtags -lpgcommon -lpgport -lz -lreadline -lpthread -lrt -ldl -lm -o pg_isolation_regressmake[2]: Leaving directory `/opt/postgresql/soft/postgresql-14.6/src/test/isolation'make -C test/perl allmake[2]: Entering directory `/opt/postgresql/soft/postgresql-14.6/src/test/perl'make[2]: Nothing to be done for `all'.make[2]: Leaving directory `/opt/postgresql/soft/postgresql-14.6/src/test/perl'make[1]: Leaving directory `/opt/postgresql/soft/postgresql-14.6/src'make -C config allmake[1]: Entering directory `/opt/postgresql/soft/postgresql-14.6/config'make[1]: Nothing to be done for `all'.make[1]: Leaving directory `/opt/postgresql/soft/postgresql-14.6/config'[postgres@test postgresql-14.6]$ make install......make -C config installmake[1]: Entering directory `/opt/postgresql/soft/postgresql-14.6/config'/bin/mkdir -p '/usr/local/pgsql-14.6/lib/pgxs/config'/bin/install -c -m 755 ./install-sh '/usr/local/pgsql-14.6/lib/pgxs/config/install-sh'/bin/install -c -m 755 ./missing '/usr/local/pgsql-14.6/lib/pgxs/config/missing'make[1]: Leaving directory `/opt/postgresql/soft/postgresql-14.6/config'5、创建软连接,方便以后升级[postgres@test pgsql-14.6]$ exitlogout[root@test postgresql-14.6]# ln -s /usr/local/pgsql-14.6/ /usr/local/pgsql6、配置环境变量[postgres@test ~]$ vim .bash_profile#末尾添加这些信息:export PATH=/usr/local/pgsql/bin:$PATHexport LD_LIBRARY_PATH=/usr/local/pgsql/lib:$LD_LIBRARY_PATH[postgres@test ~]$ source .bash_profile7、初始化环境[postgres@test ~]$ export PGDATA=/opt/postgresql/pgdata[postgres@test ~]$ mkdir /opt/postgresql/pgdata[postgres@test ~]$ initdbThe files belonging to this database system will be owned by user "postgres".This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /opt/postgresql/pgdata ... okcreating subdirectories ... okselecting dynamic shared memory implementation ... posixselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting default time zone ... Asia/Shanghaicreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... oksyncing data to disk ... okinitdb: warning: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success. You can now start the database server using:pg_ctl -D /opt/postgresql/pgdata -l logfile start8、启动数据库[postgres@test ~]$ pg_ctl -D /opt/postgresql/pgdata -l logfile start[postgres@test ~]$ ps -ef | grep postgresroot 75725 25505 0 14:59 pts/0 00:00:00 su - postgrespostgres 75729 75725 0 14:59 pts/0 00:00:00 -bashpostgres 75755 75729 0 15:00 pts/0 00:00:00 ps -efpostgres 75756 75729 0 15:00 pts/0 00:00:00 grep --color=auto postgrespostgres 122926 1 0 Feb28 ? 00:00:00 /usr/local/pgsql-14.6/bin/postgres -D /opt/postgresql/pgdatapostgres 122928 122926 0 Feb28 ? 00:00:00 postgres: checkpointerpostgres 122929 122926 0 Feb28 ? 00:00:00 postgres: background writerpostgres 122930 122926 0 Feb28 ? 00:00:00 postgres: walwriterpostgres 122931 122926 0 Feb28 ? 00:00:00 postgres: autovacuum launcherpostgres 122932 122926 0 Feb28 ? 00:00:01 postgres: stats collectorpostgres 122933 122926 0 Feb28 ? 00:00:00 postgres: logical replication launcher安装 libxml2
1、上传安装包[postgres@test ~]$ cd /opt/postgresql/soft[postgres@test soft]$ rz2、解压缩[postgres@test soft]$ xz -d libxml2-2.9.9.tar.xz[postgres@test soft]$ tar -xvf libxml2-2.9.9.tar3、安装[postgres@test soft]$ cd libxml2-2.9.9[postgres@test libxml2-2.9.9]$ ./configure --prefix=/usr/local/libxml2[postgres@test libxml2-2.9.9]$ make && make install......make[4]: Entering directory `/opt/postgresql/soft/libxml2-2.9.9/python'CC libxml.lolibxml.c:14:20: fatal error: Python.h: No such file or directory#include <Python.h>^compilation terminated.make[4]: *** [libxml.lo] Error 1make[4]: Leaving directory `/opt/postgresql/soft/libxml2-2.9.9/python'make[3]: *** [all-recursive] Error 1make[3]: Leaving directory `/opt/postgresql/soft/libxml2-2.9.9/python'make[2]: *** [all] Error 2make[2]: Leaving directory `/opt/postgresql/soft/libxml2-2.9.9/python'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/opt/postgresql/soft/libxml2-2.9.9'make: *** [all] Error 2报错没有找到 python 的头文件,安装 python 开发包解决[postgres@test libxml2-2.9.9]$ exitlogout[root@test postgresql-14.6]# mkdir /usr/local/libxml2[root@test postgresql-14.6]# chown postgres:postgres /usr/local/libxml2[root@test postgresql-14.6]# yum install python-devel[root@test postgresql-14.6]# su - postgresLast login: Tue Feb 28 10:01:38 CST 2023 on pts/1[postgres@test ~]$ cd /opt/postgresql/soft/libxml2-2.9.9[postgres@test libxml2-2.9.9]$ make && make install安装 geos
1、上传安装包[postgres@test ~]$ cd /opt/postgresql/soft[postgres@test soft]$ rz2、解压缩[postgres@test soft]$ tar -xvf geos-3.6.6.tar.bz23、安装[postgres@test soft]$ cd geos-3.6.6[postgres@test geos-3.6.6]$ ./configure --prefix=/usr/local/geos[postgres@test geos-3.6.6]$ exitlogout[root@test postgresql-14.6]# mkdir /usr/local/geos[root@test postgresql-14.6]# chown postgres:postgres /usr/local/geos[root@test postgresql-14.6]# su - postgres[postgres@test ~]$ cd /opt/postgresql/soft/geos-3.6.6[postgres@test geos-3.6.6]$ make && make install安装 proj
1、上传安装包[postgres@test ~]$ cd /opt/postgresql/soft[postgres@test soft]$ rz2、解压缩[postgres@test soft]$ tar -xvf proj-8.2.1.tar.gz3、安装[postgres@test soft]$ cd proj-8.2.1[postgres@test proj-8.2.1]$ ./configure --prefix=/usr/local/proj......enabled, pthreadchecking for SQLITE3... configure: error: Package requirements (sqlite3 >= 3.11) were not met:No package 'sqlite3' foundConsider adjusting the PKG_CONFIG_PATH environment variable if youinstalled software in a non-standard prefix.Alternatively, you may set the environment variables SQLITE3_CFLAGSand SQLITE3_LIBS to avoid the need to call pkg-config.See the pkg-config man page for more details.proj8 对于 sqlite 数据库有版本要求,重新安装 sqlite 数据库sqlite下载地址:SQLite Download Page上传并安装[postgres@test ~]$ cd /opt/postgresql/soft[postgres@test soft]$ rz[postgres@test soft]$ tar -xvf sqlite-autoconf-3410000.tar.gz[postgres@test soft]$ cd sqlite-autoconf-3410000[postgres@test sqlite-autoconf-3410000]$ ./configure --prefix=/usr/local/sqlite[postgres@test sqlite-autoconf-3410000]$ exit[root@test postgresql-14.6]# mkdir /usr/local/sqlite[root@test postgresql-14.6]# su - postgres[postgres@test ~]$ cd /opt/postgresql/soft/sqlite-autoconf-3410000[postgres@test sqlite-autoconf-3410000]$ make && make install修改链接[root@test postgresql-14.6]# cd /usr/bin/[root@test postgresql-14.6]# mv sqlite3 sqlite3_old[root@test postgresql-14.6]# ln -s /usr/local/sqlite/bin/sqlite3 sqlite3继续安装 proj[root@test postgresql-14.6]$ su - postgres[postgres@test ~]$ cd /opt/postgresql/soft/proj-8.2.1[postgres@test proj-8.2.1]$ ./configure --prefix=/usr/local/proj......checking for sqlite3... yeschecking for TIFF... configure: error: Package requirements (libtiff-4) were not met:No package 'libtiff-4' foundConsider adjusting the PKG_CONFIG_PATH environment variable if youinstalled software in a non-standard prefix.Alternatively, you may set the environment variables TIFF_CFLAGSand TIFF_LIBS to avoid the need to call pkg-config.See the pkg-config man page for more details.报错找不到 libtiff-4 包,服务器已经安装了[postgres@test proj-8.2.1]$ rpm -qa libtifflibtiff-4.0.3-35.el7.x86_64尝试安装开发包,发现可以解决问题[root@test postgresql-14.6]# yum install libtiff-devel继续安装 proj[postgres@test proj-8.2.1]# ./configure --prefix=/usr/local/proj.....checking for SQLITE3... yeschecking for sqlite3... yeschecking for TIFF... yeschecking for curl-config... not-foundconfigure: error: curl not found. If wanting to do a build without curl support (and thus without built-in networking capability), explictly disable it with --without-curl报错缺少 curl 包[root@test postgresql-14.6]# yum install curl继续安装 proj[postgres@test proj-8.2.1]# ./configure --prefix=/usr/local/proj[postgres@test proj-8.2.1]# exit[root@test postgresql-14.6]# mkdir /usr/local/proj[root@test postgresql-14.6]# chown postgres:postgres /usr/local/proj[root@test postgresql-14.6]# su - postgres[postgres@test ~]$ cd /opt/postgresql/soft/proj-8.2.1[postgres@test ~]$ make && make install安装 gdal
1、上传安装包[postgres@test ~]$ cd /opt/postgresql/soft[postgres@test soft]$ rz2、解压缩[postgres@test soft]$ tar -xvf gdal-3.5.3.tar.gz3、安装[postgres@test soft]$ exit[root@test postgresql-14.6]# mkdir /usr/local/gdal[root@test postgresql-14.6]# chown postgres:postgres /usr/local/gdal[root@test postgresql-14.6]# su - postgres[postgres@test ~]$ cd /opt/postgresql/soft/gdal-3.5.3[postgres@test gdal-3.5.3]# ./configure --prefix=/usr/local/gdal......checking for curl_global_init in -lcurl... yeschecking for SQLite3 library >= 3.0.0... disabledchecking for PROJ >= 6 library... checking for proj_create_from_wkt in -lproj... nochecking for internal_proj_create_from_wkt in -lproj... nochecking for internal_proj_create_from_wkt in -linternalproj... noconfigure: error: PROJ 6 symbols not found报错找不到 PROJ 包,添加环境变量到 /etc/profile 也不见效,选择手动指定proj安装目录的方式解决。应该再尝试在 /etc/ld.so.conf 中配置库包位置试试[postgres@test gdal-3.5.3]# ./configure --prefix=/usr/local/gdal --with-proj=/usr/local/proj/[postgres@test gdal-3.5.3]# make && make install安装 json-c
1、上传安装包[postgres@test ~]$ cd /opt/postgresql/soft[postgres@test soft]$ rz2、解压缩[postgres@test soft]$ tar -xvf json-c-0.10.tar.gz3、安装[postgres@test soft]$ exit[root@test postgresql-14.6]# mkdir /usr/local/jons-c[root@test postgresql-14.6]# chown postgres:postgres /usr/local/jons-c[root@test postgresql-14.6]# su - postgres[postgres@test ~]$ cd /opt/postgresql/soft/json-c-0.10[postgres@test json-c-0.10]$ ./configure --prefix=/usr/local/json-c[postgres@test json-c-0.10]$ make && make install安装 postgis
1、上传安装包[postgres@test ~]$ cd /opt/postgresql/soft[postgres@test soft]$ rz2、解压缩[postgres@test soft]$ tar -xvf postgis-3.2.4.tar.gz3、安装[postgres@test postgis-3.2.4]# ./configure --prefix=/usr/local/postgis......checking libxml/xpathInternals.h usability... yeschecking libxml/xpathInternals.h presence... yeschecking for libxml/xpathInternals.h... yeschecking for xmlInitParser in -lxml2... yeschecking for geos-config... noconfigure: error: could not find geos-config within the current path. You may need to try re-running configure with a --with-geosconfig parameter.[postgres@test postgis-3.2.4]# ./configure --prefix=/usr/local/postgis --with-geosconfig=/usr/local/bin/geos-config......configure: WARNING: "Could not find json-c"checking for PROTOBUFC... nolibprotobuf-c not found in pkg-configchecking protobuf-c/protobuf-c.h usability... nochecking protobuf-c/protobuf-c.h presence... nochecking for protobuf-c/protobuf-c.h... noconfigure: error: unable to find protobuf-c/protobuf-c.h using CPPFLAGS. You can disable MVT and Geobuf support using --without-protobuf报错找不到 protobuf-c 包,尝试使用 yum 安装,安装完成之后问题未解决手动下载 protobuf-c 进行安装安装 protobuf-c下载地址Releases · protobuf-c/protobuf-c · GitHub上传并安装[postgres@test ~]$ cd /opt/postgresql/soft[postgres@test soft]$ rz[postgres@test soft]# tar -xvf protobuf-c-1.4.1.tar.gz[postgres@test soft]$ exit[root@test postgresql-14.6]# mkdir /usr/local/protobuf-c[root@test postgresql-14.6]# chown postgres:postgres /usr/local/protobuf-c[root@test postgresql-14.6]# su - postgres[postgres@test soft]# cd /opt/postgresql/soft/protobuf-c-1.4.1[postgres@test protobuf-c-1.4.1]# ./configure --prefix=/usr/local/protobuf-c......checking whether g++ supports C++11 features with -std=c++11... yeschecking for protobuf... nochecking for protobuf... noconfigure: error: Package requirements (protobuf >= 2.6.0) were not met:No package 'protobuf' foundConsider adjusting the PKG_CONFIG_PATH environment variable if youinstalled software in a non-standard prefix.Alternatively, you may set the environment variables protobuf_CFLAGSand protobuf_LIBS to avoid the need to call pkg-config.See the pkg-config man page for more details.protobuf-c 依赖与 protobuf 包,需要先安装 protobuf 包安装 protobuf 包https://github.com/google/protobuf/releases上传并安装[postgres@test ~]$ cd /opt/postgresql/soft[postgres@test soft]$ rz[postgres@test soft]# tar -xvf protobuf-all-3.6.1.tar.gz[postgres@test soft]$ exit[root@test postgresql-14.6]# mkdir /usr/local/protobuf[root@test postgresql-14.6]# chown postgres:postgres /usr/local/protobuf[root@test postgresql-14.6]# su - postgres[postgres@test ~]$ cd /opt/postgresql/soft/protobuf-3.6.1[postgres@test protobuf-c-1.4.1]$ ./configure --prefix=/usr/local/protobuf[postgres@test protobuf-c-1.4.1]$ make && make install继续安装 protobuf-c[postgres@test protobuf-c-1.4.1]$ ./configure --prefix=/usr/local/protobuf-c[postgres@test protobuf-c-1.4.1]$ make && make install继续安装 postgis[postgres@test postgis-3.2.4]$ ./configure --prefix=/usr/local/postgis --with-geosconfig=/usr/local/bin/geos-config如果还报 protobuf-c 找不到的问题,把 protobuf-c 的库加入到环境变量中去vim /etc/profileexport LD_LIBRARY_PATH=/usr/local/protobuf/lib:$LD_LIBRARY_PATH[postgres@test postgis-3.2.4]$ make && make installpostgresql 接入 postgis 扩展
1、创建一个数据库[postgres@test ~]$ psqlgisdb=# create database gisdb;2、加载 postgis 插件gisdb=# create extension postgis;ERROR: could not load library "/usr/local/pgsql-14.6/lib/postgis-3.so": libgeos_c.so.1: cannot open shared object file: No such file or directory将所安装的软件库都加入到共享库解决上述问题[root@test ~]# vim /etc/ld.so.conf/usr/local/gdal/lib/usr/local/geos/lib/usr/local/proj/lib/usr/local/pgsql/lib/usr/local/json-c/lib/usr/local/libxml2/lib/usr/local/protobuf/lib/usr/local/protobuf-c/lib[root@test ~]# ldconfiggisdb=# create extension postgis;CREATE EXTENSION至此安装完成

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/63048.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

工业大数据分析算法实战-day05

文章目录 day05分而治之中的MARS算法神经网络逼近能力解释 day05 今天是第5天&#xff0c;昨日从统计分析开始利用统计学的知识判断当前样本的分布以及估计总体的参数和假设检验的情况&#xff0c;以及介绍了线性回归算法的相关优化点&#xff0c;但是毕竟线性回归是线性划分的…

在Ubuntu服务器上备份文件到自己的百度网盘

文章目录 概述安装bypy同步文件定时任务脚本 概述 之前自购了一台阿里云服务器&#xff0c;系统镜像为Ubuntu 22.04&#xff0c; 并且搭建了LNMP开发环境&#xff08;可以参考&#xff1a;《Ubuntu搭建PHP开发环境操作步骤(保姆级教程)》&#xff09;。由于项目运行中会产生附…

safe area helper插件

概述 显示不同机型的必能显示的区域 实现步骤 引入safearea&#xff0c;引入其中的safearea的csharp 为cancas加入gameobject gameobject中加入safearea脚本 将UI作为这个gameobject的子物体&#xff0c;就可以完成显示

Unity 获取鼠标点击位置物体贴图颜色

实现 Ray ray Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out RaycastHit hit)) {textureCoord hit.textureCoord;textureCoord.x * textureMat.width;textureCoord.y * textureMat.height;textureColor textureMat.GetPixel(Mathf.Flo…

基于深度学习的猫狗识别系统【深度学习课设】

&#x1f3c6; 作者简介&#xff1a;席万里 ⚡ 个人网站&#xff1a;https://dahua.bloggo.chat/ ✍️ 一名后端开发小趴菜&#xff0c;同时略懂Vue与React前端技术&#xff0c;也了解一点微信小程序开发。 &#x1f37b; 对计算机充满兴趣&#xff0c;愿意并且希望学习更多的技…

05、GC基础知识

JVM程序在跑起来之后&#xff0c;在数据的交互过程中&#xff0c;就会有一些数据是过期不用的&#xff0c;这些数据可以看做是垃圾&#xff0c;JVM中&#xff0c;这些垃圾是不用开发者管的&#xff0c;它自己会有一套垃圾回收系统自动回收这些内存垃圾&#xff0c;以备后面继续…

什么是战略思想?

古今中外&#xff0c;关于战略是什么&#xff1f;有非常多的理论&#xff0c;也有不同的视角。 中国最早的涉及战略的书籍据传是黄帝所著的《握奇文》&#xff0c;后有较为系统的兵法战略书籍为周朝姜太公&#xff08;亦称姜尚、姜子牙等&#xff09;所著的《六韬》&#xff0c…

2024.12.15 TCP/IP 网络模型有哪几层?(二)

2024.12.15 TCP/IP 网络模型有哪几层?&#xff08;二&#xff09; 上节课我们学习了网络模型有四部分构成&#xff0c;有应用层、传输层、网络层、网络接口层。 生成了 IP 头部之后&#xff0c;接下来要交给网络接口层(Link Layer)在 IP 头部的前面加上 MAC 头部&#xff0c…

51c深度学习~合集9

我自己的原文哦~ https://blog.51cto.com/whaosoft/12750420 #傅里叶特征 (Fourier Feature&#xff09;与核回归 位置编码背后的理论解释 本文探讨了位置编码背后的理论基础&#xff0c;特别是傅里叶特征&#xff08;Fourier Feature&#xff09;与核回归&#xff08;Kern…

Flutter Navigator2.0的原理和Web端实践

01 背景与动机 在Navigator 2.0推出之前&#xff0c;Flutter主要通过Navigator 1.0和其提供的 API&#xff08;如push(), pop(), pushNamed()等&#xff09;来管理页面路由。然而&#xff0c;Navigator 1.0存在一些局限性&#xff0c;如难以实现复杂的页面操作&#xff08;如移…

代码随想录算法训练营第三天 | 链表理论基础 | 707.设计链表

要求太多&#xff0c;代码量太大&#xff0c;实在难以完成 在以前听说&#xff0c;好的程序员&#xff0c;可以在短时生成大量的代码&#xff0c;本题只方法才只有6个&#xff0c;根本不算多 每天手敲代码量太少&#xff0c;才是问题 #include <iostream>class MyLink…

数据冒险、控制冒险、结构冒险

计算机组成原理 数据冒险、控制冒险、结构冒险 对所有用户&#xff08;所有程序员&#xff09;可见&#xff1a;PSW、PC、通用寄存器 PSW&#xff08;条件转移需要用到&#xff0c;程序员使用CMP指令的时候也需要用到所以是对用户可见&#xff09;PC&#xff08;跳转指令需要…

基于32单片机的RS485综合土壤传感器检测土壤PH、氮磷钾的使用(超详细)

1-3为RS485综合土壤传感器的基本内容 4-5为基于STM32F103C8T6单片机使用RS485传感器检测土壤PH、氮磷钾并显示在OLED显示屏的相关配置内容 注意&#xff1a;本篇文件讲解使用的是PH、氮磷钾四合一RS485综合土壤传感器&#xff0c;但里面的讲解内容适配市面上的所有多合一的RS…

SpringBoot【十一】mybatis-plus实现多数据源配置,开箱即用!

一、前言&#x1f525; 环境说明&#xff1a;Windows10 Idea2021.3.2 Jdk1.8 SpringBoot 2.3.1.RELEASE 正常情况下我们在开发系统的时候都是使用一个数据源&#xff0c;但是由于有些项目同步数据的时候不想造成数据库io消耗压力过大&#xff0c;便会一个项目对应多个数据源…

Node.js教程入门第一课:环境安装

对于一个程序员来说&#xff0c;每学习一个新东西的时候&#xff0c;第一步基本上都是先进行环境的搭建&#xff01; 从本章节开始让我们开始探索Node.js的世界吧! 什么是Node.js? 那么什么是Node.js呢&#xff1f;简单的说Node.js 就是运行在服务端的 JavaScript JavaScript…

vim优化

1.编辑如下内容&#xff1a; cat > /root/.vimrc <<EOF set tabstop2 " 设置 Tab 为 2 个空格 set shiftwidth2 " 设置自动缩进为 2 个空格 set expandtab " 将 Tab 转换为空格 " 基本设置 set number syntax on" 快捷键设置…

字符串性能对比

效率(1) : String.indexOf与String.contains效率测试_string contains效率-CSDN博客 结论是前者效率高&#xff0c;源码里面conatins是使用indexof 在jdk8中contains直接调用的indexOf(其他版本没有验证),所以要说效率来说肯定是indexOf高,但contains也就多了一层方法栈,so 什…

移动网络的原理

无线网络是如何解决移动通信问题的 场景&#xff1a;用户在一辆轿车内以150km/h的时速沿高速公路急速行驶时穿过多个无线接入网&#xff0c;用户希望在整个旅程中保持一个与远程应用的不间断的TCP连接。 解决方案&#xff1a;移动节点的间接路由选择方法可解决TCP链接不间断的…

python学opencv|读取图像(十三)BGR图像和HSV图像互相转换深入

【1】引言 前序学习过程中&#xff0c;我们偶然发现&#xff1a;如果原始图像是png格式&#xff0c;将其从BGR转向HSV&#xff0c;再从HSV转回BGR后&#xff0c;图像的效果要好于JPG格式。 文章链接为&#xff1a; python学opencv|读取图像&#xff08;十二&#xff09;BGR图…

解决node.js的req.body为空的问题

从昨晚一直在试&#xff0c;明明之前用的封装的axios发送请求给其他的后端&#xff08;springboot&#xff09;是可以的&#xff0c;但昨天用了新项目的后端&#xff08;node.js&#xff09;就不行。 之前用了代理&#xff0c;所以浏览器发送的post请求不会被拦截&#xff0c;…