当前位置: 首页 > news >正文

快速且靠谱的简单安装 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至此安装完成

相关文章:

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

快速且靠谱的简单安装 PostgreSQL 15 yum 安装postgis3.3 1、确保已经安装了PostgreSQL数据库。2、添加PostGIS的EPEL仓库3、使用YUM安装PostGIS4、以下为其他安装方式&#xff0c;一个个去找源码的编译安装&#xff0c;过程较为繁琐&#xff08;不熟路的不推荐&#xff09; 要…...

MySQL八股文

MySQL 自己学习过程中的MySQL八股笔记。 主要来源于 小林coding 牛客MySQL面试八股文背诵版 以及b站和其他的网上资料。 MySQL是一种开放源代码的关系型数据库管理系统&#xff08;RDBMS&#xff09;&#xff0c;使用最常用的数据库管理语言–结构化查询语言&#xff08;SQL&…...

Python高性能web框架-FastApi教程:(1)创建一个简单的FastApi

&#xff08;1&#xff09;创建一个简单的FastApi 1. 导入必要的库 from fastapi import FastAPI import uvicornFastAPI 是一个用于构建现代、快速&#xff08;高性能&#xff09;的Web API的Python框架。uvicorn 是一个ASGI服务器&#xff0c;用于运行异步的Python Web应用…...

多模态机器学习综述论文|Multimodal Machine Learning: A Survey and Taxonomy

1. 引言 多模态机器学习是一个跨学科领域&#xff0c;它涉及到从多种感官模态&#xff08;如视觉、听觉、触觉等&#xff09;中提取信息&#xff0c;并构建能够处理和关联这些信息的模型。这种学习方式对于人工智能理解复杂世界至关重要。 名词解释&#xff1a; 模态Modality…...

CentOS8:英伟达显卡驱动与CUDA安装

挺偶然的&#xff0c;同事在CentOS8版本的GPU服务器上安装英伟达的显卡驱动和CUDA遇到了问题&#xff0c;于是协助进行了安装&#xff0c;顺便记录下此次安装过程与心得。 目录 显卡驱动安装 步骤简述 详细步骤 1、官网下载需要的驱动 2、驱动软件包上传并加权 3、安装…...

【IDEA】启动报错

今天启动IDEA报错 报错信息&#xff1a; Cannot connect to already running IDE instance. Exception: Process 5,444 is still running 打开任务管理器&#xff0c;关掉进程ID5444的任务...

Opencv之图像梯度处理和绘制图像轮廓

一、梯度处理的sobel算子函数 处理示意 Sobel 算子是一种常用的图像边缘检测方法&#xff0c;结合了一阶导数和高斯平滑&#xff0c;用于检测图像的梯度信息。 1、功能 Sobel 算子用于计算图像在 x 和 y 方向的梯度&#xff0c;主要功能包括&#xff1a; 强调图像中灰度值的…...

5.2章节python字符串的格式化三种方式

在Python中&#xff0c;格式化字符串是编程中常见的任务&#xff0c;它用于将变量或表达式的值嵌入到字符串中。以下是三种常见的格式化字符串的方式&#xff1a; 1.百分号&#xff08;%&#xff09;格式化&#xff1a; 这是Python早期版本中常用的字符串格式化方法。通过在字…...

.NET Core 各版本特点、差异及适用场景详解

随着 .NET Core 的不断发展&#xff0c;微软推出了一系列版本来满足不同场景下的开发需求。这些版本随着时间的推移逐渐演变为统一的 .NET 平台&#xff08;从 .NET 5 开始&#xff09;。本文将详细说明每个版本的特点、差异以及适用场景&#xff0c;帮助开发者更好地选择和使用…...

2024.12.14 TCP/IP 网络模型有哪几层?

2024.12.14 TCP/IP 网络模型有哪几层? 2024.12.14 今天周六 看到大伙都在考六级&#xff0c;我来复盘小林coding的计算机网络的知识点&#xff1a; TCP/IP 网络模型有哪几层? 问大家&#xff0c;为什么要有 TCP/IP 网络模型? 对于同一台设备上的进程间通信&#xff0c;有…...

基于SpringBoot的嗨玩旅游网站:一站式旅游信息服务平台的设计与实现

摘要 在旅游需求日益增长的今天&#xff0c;一个全面、便捷的旅游信息服务平台显得尤为重要。嗨玩旅游网站正是为了满足这一需求而设计的在线平台&#xff0c;它提供了包括景点信息、旅游线路、商品信息、社区信息和活动推广等在内的丰富旅游目的地信息&#xff0c;旨在帮助用…...

HQChart使用教程30-K线图如何对接第3方数据42-DRAWTEXTREL,DRAWTEXTABS数据结构

HQChart使用教程30-K线图如何对接第3方数据42-DRAWTEXTREL,DRAWTEXTABS数据结构 效果图DRAWTEXTREL示例数据结构说明nametypecolorDrawVAlignDrawAlignDrawDrawTypeDrawDataFont DRAWTEXTABS示例数据结构说明nametypecolorDrawVAlignDrawAlignDrawDrawTypeDrawDataFont 效果图 …...

VMware ESXi上创建Ubuntu虚拟机并实现远程SSH访问全攻略

文章目录 前言1. 在VMware ESXI中创建Ubuntu虚拟机2. Ubuntu开启SSH远程服务3. 安装Cpolar工具4. 使用SSH客户端远程访问Ubuntu5. 固定TCP公网地址 前言 本文主要介绍如何在VMware ESXi上创建一台Ubuntu 22.04虚拟机&#xff0c;并通过Cpolar内网穿透工具配置公网地址&#xf…...

进制的转换

前言 ‌进制‌是一种进位计数制&#xff0c;是人为定义的带进位的计数方法。不同的进制使用不同数量的符号&#xff0c;以及不同的规则来组合这些符号以表示不同的数值。 一、进制类型 二进制:由一串0和1组成的数字&#xff0c;逢二进一 八进制:0 1 2 3 4 5 6 7&#xff0c;…...

迁移学习中模型训练加速(以mllm模型为例),提速15%以上

根据模型训练过程的显存占用实测的分析,一个1g参数的模型(存储占用4g)训练大约需要20g的显存,其中梯度值占用的显存约一半。博主本意是想实现在迁移学习(冻结部分参数)中模型显存占用的降低,结果不太满意,只能实现训练速度提升,但无法实现显存占用优化。预计是在现有的…...

CSS系列(6)-- 排版与文本详解

前端技术探索系列&#xff1a;CSS 排版与文本详解 &#x1f4dd; 致读者&#xff1a;探索优雅的文字艺术 &#x1f44b; 前端开发者们&#xff0c; 今天我们将深入探讨 CSS 排版与文本处理&#xff0c;学习如何创建既美观又易读的文本内容。 文本基础属性 &#x1f680; 字…...

嵌入式现状、机遇、挑战与展望

在当今数字化浪潮中&#xff0c;嵌入式系统宛如一颗璀璨的明珠&#xff0c;熠熠生辉&#xff0c;深刻地渗透到了我们生活的方方面面&#xff0c;成为推动现代科技进步不可或缺的关键力量。从智能家居的便捷控制&#xff0c;到工业生产的精准运作&#xff0c;再到汽车的智能驾驶…...

关于Postgresql旧版本安装

抛出问题 局点项目现场&#xff0c;要求对如下三类资产做安全加固&#xff0c;需要在公司侧搭建测试验证环境&#xff0c;故有此篇。 bclinux 8.2 tomcat-8.5.59 postgrel -11 随着PG迭代&#xff0c;老旧版本仅提供有限维护。如果想安装老版本可能就要费劲儿一些。现在&…...

【AI日记】24.12.14 kaggle 比赛 2-4 EDA

【AI论文解读】【AI知识点】【AI小项目】【AI战略思考】【AI日记】 工作 参加&#xff1a;kaggle 比赛 Regression with an Insurance Dataset内容&#xff1a;构建自己的EDA&#xff08;探索性数据分析&#xff09;框架时间&#xff1a;5 小时感想&#xff1a;大规模数据集&a…...

《深入浅出HTTPS》读书笔记(18):公开密钥算法RSA(续)

【RSA算法安全性】 幂运算的逆过程就是求对数问题&#xff0c;而模运算可以认为是离散问题&#xff0c;组合起来RSA算法就是离散对数模型&#xff0c;只要密钥长度足够长&#xff0c;离散对数很难破解。 破解私钥有两个方法&#xff1a; ◎公钥持有人有e和n&#xff0c;而要计…...

LabVIEW面向对象编程有什么特点?

LabVIEW面向对象编程&#xff08;OOP&#xff09;的特点主要体现在它如何结合传统面向对象编程&#xff08;OOP&#xff09;的理念与LabVIEW的图形化编程模式&#xff0c;提供灵活的抽象和模块化的功能。以下是LabVIEW面向对象编程的几个主要特点&#xff1a; ​ 1. 类&#x…...

【Hive数据仓库】Hive部署、Hive数据库操作(增删改查)、表操作(内部表、外部表、分区表、桶表)

目录 一、本地模式 1、安装MySQL 2、登录MySQL 3、修改密码 4、安装Hive 5、配置Hive系统环境变量 6、初始化Derby数据库 7、连接Hive用于测试 8、测试Hive 9、修改Hive配置文件 10、上传MySQL驱动包 11、初始化MySQL 12、连接Hive用于启动服务 二、远程模式 1、…...

bugku-simple MQTT-wp解析

1.下载题目打开题目&#xff0c;是一个流量包&#xff0c;题目说是MQTT&#xff0c;然后打开流量之后的流量都是MQTT&#xff0c;我们来搜一下MQTT是什么流量 MQTT流量&#xff1a; 是一种基于发布订阅模式的轻量级的通讯协议&#xff0c;并且该协议构建于TCP/IP协议之上&…...

【第四节】Git 分支管理

目录 前言 一、Git 分支简介 二、 分支的基本操作 2.1 创建分支 2.2 切换分支 2.3 列出分支 三、 分支的合并与删除 3.1 合并分支 3.2 删除分支 四、处理合并冲突 五、 总结 前言 Git 的分支管理是其核心功能之一&#xff0c;允许开发者在不影响主线开发的情况下进行…...

IDEA 修改格式化仅格式化本次改动代码

最近总是发现格式化的时候会格式化文件所有代码&#xff0c;提交Git 后再看提交日志&#xff0c;就很不清晰。修改方式如下 中文&#xff1a; 格式化代码快捷键[中文配置]&#xff1a; 英文&#xff1a; 格式化代码快捷键[英文配置]&#xff1a;...

UOB大华银行|校招网申综合能力SHL测评题库英语版本真题分析

大华银行有限公司&#xff08;大华银行&#xff09;是亚洲银行业的翘楚&#xff0c;大华银行总部位于新加坡&#xff0c;并在中国、印度尼西亚、马来西亚、泰国及越南设立了全资法人银行&#xff0c;在全球拥有约500 间分行及办事处&#xff0c;分布在亚太、欧洲与北美的19 个国…...

Redis应用—2.在列表数据里的应用

大纲 1.基于数据库 缓存双写的分享贴功能 2.查询分享贴列表缓存时的延迟构建 3.分页列表惰性缓存方案如何节约内存 4.用户分享贴列表数据按页缓存实现精准过期控制 5.用户分享贴列表的分页缓存的异步更新 6.数据库与缓存的分页数据一致性方案 7.热门用户分享贴列表的分…...

【Linux基础】基本开发工具的使用

目录 一、编译器——gcc/g的使用 gcc/g的安装 gcc的安装&#xff1a; g的安装&#xff1a; gcc/g的基本使用 gcc的使用 g的使用 动态链接与静态链接 程序的翻译过程 1. 一个C/C程序的构建过程&#xff0c;程序从源代码到可执行文件必须经历四个阶段 2. 理解选项的含…...

C++ 中面向对象编程如何实现动态绑定?

在 C 中&#xff0c;面向对象编程的一个重要特性就是动态绑定。动态绑定允许在程序运行时根据对象的实际类型来决定调用哪个函数&#xff0c;这为程序的灵活性和可扩展性提供了强大的支持。本文将详细介绍 C 中面向对象编程如何实现动态绑定。 一、静态绑定与动态绑定的概念 静…...

电源芯片的SYNC引脚

-----本文简介----- 主要内容包括&#xff1a; ① 电源芯片的SYNC引脚 ----- 正文 ----- 先赞↓后看&#xff0c;养成习惯&#xff01; 1. SYNC引脚是什么&#xff1f; 电源芯片里面的SYNC引脚是 Synchronization clock in&#xff0c;意思是同步时钟输入。 2. SYNC引脚的作用…...

安卓报错Switch Maven repository ‘maven‘....解决办法

例如&#xff1a;Switch Maven repository ‘maven(http://developer.huawei.com/repo/)’ to redirect to a secure protocol 在库链接上方添加配置代码&#xff1a;allowInsecureProtocol true...

935. 骑士拨号器

935. 骑士拨号器 题目链接&#xff1a;935. 骑士拨号器 代码如下&#xff1a; class Solution { public:int knightDialer(int n) {if (n 1){return 10;}long long res 0;for (int j 0; j < 10; j){res dfs(n - 1, j);}return res % MOD;}int dfs(int i, int j){if (…...

linux下的posix信号量

目录 引言 信号量背景知识 PV操作 信号量接口 基于环形队列的PC模型 代码实现 demo模型 具体实现 引言 在多线程编程领域&#xff0c;同步机制是确保数据一致性和避免竞态条件的关键技术。Linux操作系统作为开源软件的杰出代表&#xff0c;提供了多种同步原语&#xf…...

【JavaWeb后端学习笔记】Spring框架下的Bean管理

Bean 1、Bean的获取2、Bean的作用域3、第三方Bean 1、Bean的获取 默认情况下&#xff0c;Spring项目启动时&#xff0c;会把Bean创建好交给IOC容器管理。当需要使用时&#xff0c;通过Autowired注解注入或者通过构造方法注入即可。 除此之外还可以通过Spring提供的Applicatio…...

如何在 ASP.NET Core 3.1 应用程序中使用 Log4Net

介绍 日志记录是应用程序的核心。它对于调试和故障排除以及应用程序的流畅性非常重要。 借助日志记录&#xff0c;我们可以对本地系统进行端到端的可视性&#xff0c;而对于基于云的系统&#xff0c;我们只能提供一小部分可视性。您可以将日志写入磁盘或数据库中的文件&#xf…...

Photoshop提示错误弹窗dll缺失是什么原因?要怎么解决?

Photoshop提示错误弹窗“DLL缺失”&#xff1a;原因分析与解决方案 在创意设计与图像处理领域&#xff0c;Photoshop无疑是众多专业人士和爱好者的首选工具。然而&#xff0c;在使用Photoshop的过程中&#xff0c;有时会遇到一些令人头疼的问题&#xff0c;比如突然弹出的错误…...

mall-admin-web开源项目搭建教程(图文)

本章教程,介绍如何在本地部署运行mall-admin-web这个开源项目。 开源地址:https://gitee.com/macrozheng/mall-admin-web mall-admin-web是一个电商后台管理系统的前端项目,基于Vue+Element实现。主要包括商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计…...

nginx做为文件服务器

docker-compose 创建nginx version: 3services:nginx-web:image: nginx:1.23.4container_name: nginx-webenvironment:# 时区上海TZ: Asia/Shanghaiports:- "88:80"- "443:443"volumes:# 证书映射- /home/dockerdata/nginx/cert:/etc/nginx/cert# 配置文件…...

加速合并,音频与字幕的探讨

因上一节。合并时速度太慢了。显卡没用上。所以想快一点。1分钟的视频用了5分钟。 在合并视频时,进度条中的 now=None 通常表示当前处理的时间点没有被正确记录或显示。这可能是由于 moviepy 的内部实现细节或配置问题。为了加快视频合并速度并利用 GPU 加速,可以采取以下措…...

(3)spring security - 认识PasswordEncoder

目录 1.简介1.1.简单了解认证流程 2.密码验证3.PasswordEncoder的内置实现4.小结 目标&#xff1a; 简单了解认证的流程简单认识spring security中的Password Encoder 1.简介 还是以这幅图为基础&#xff0c;认识Password Encoder到底是什么&#xff1f; 1.1.简单了解认证流程…...

React 入门:JSX语法详解

简介 React是一个用于构建用户界面的JavaScript库&#xff0c;它引入了JSX语法&#xff0c;使得你可以在JavaScript代码中编写类似HTML的结构。JSX在编译后会被转换成合法的JavaScript对象。 JSX基础 JSX是一种看起来像HTML的JavaScript语法扩展。它并不直接被浏览器执行&am…...

Pandas常见函数

Pandas 是 Python 中用于数据分析和处理的强大工具库。以下是 Pandas 中一些常见的函数和方法&#xff0c;按用途分类总结&#xff1a; 1. 数据创建 pd.Series(data, index)&#xff1a;创建一维的序列对象。pd.DataFrame(data, index, columns)&#xff1a;创建二维的DataFra…...

【笔试】亚马逊

亚马逊的笔试题目有两道&#xff0c;一共70分钟 1.给一个数组代表每轮损失的血量power&#xff0c;另外一个变量是盾牌armor&#xff0c;可以选择任意一轮使用这个盾牌&#xff0c;可以抵挡min&#xff08;power[i],armor&#xff09;的攻击&#xff0c;请问最小血量是多少能够…...

【力扣算法】234.回文链表

快慢指针&#xff1a;一个指针走两步&#xff0c;一个指针走一步&#xff0c;当快指针走到链表末尾时&#xff0c;慢指针走到中间位置。 逆转链表&#xff1a;根据指针位置分成两个表&#xff0c;逆转第二个表。 按序判断就可以&#xff0c;如果是相同就是回文&#xff0c;反之…...

vue3-tp8-Element:对话框实现

效果 参考框架 Dialog 对话框 | Element Plus 具体实现 一、建立view页面 /src/views/TestView.vue 二、将路径写入路由 /src/router/index.js import { createRouter, createWebHistory } from vue-router import HomeView from ../views/HomeView.vueconst router create…...

35、Firefly_rk3399 同步互斥

文章目录 1、简述问题2、原子操作&#xff08;atomic_ops &#xff09;指令解析&#xff1a; 3、锁函数说明3.1、自旋锁API例子 3.2、信号量&#xff08;semaphore&#xff09;API例子 3.3、互斥量/锁API例子 3.4、信号量和互斥锁的区别 4、锁的内核实现4.1、自旋锁&#xff08…...

Docker-Dockerfile、registry

Dockerfile 一、概述 1、commit的局限 很容易制作简单的镜像&#xff0c;但碰到复杂的情况就十分不方便&#xff0c;例如碰到下面的情况&#xff1a; 需要设置默认的启动命令需要设置环境变量需要指定镜像开放某些特定的端口 2、Dockerfile是什么 Dockerfile是一种更强大的镜…...

chattts生成的音频与字幕修改完善,每段字幕对应不同颜色的视频,准备下一步插入视频。

上一节中&#xff0c;实现了先生成一个固定背景的与音频长度一致的视频&#xff0c;然后插入字幕。再合并成一个视频的方法。 但是&#xff1a;这样有点单了&#xff0c;所以&#xff1a; 1.根据字幕的长度先生成视频片断 2.在片段上加上字幕。 3.合并所有片断&#xff0c;…...

8、笔记本品牌分类介绍:LG - 计算机硬件品牌系列文章

LG笔记本品牌以其高性能和先进技术而闻名&#xff0c;‌提供多种型号以满足不同用户的需求。‌ LG笔记本产品线包括多种类型&#xff0c;‌以满足不同用户的需求。‌其中&#xff0c;‌LG Gram Pro系列以其超薄设计和高性能配置受到关注。‌该系列笔记本采用16:10的OLED显示屏&…...

在 Vue 2 中隐藏页面元素的方法

目录 在 Vue 2 中隐藏页面元素的方法 引言 1. 使用 v-if 指令 2. 使用 v-show 指令 3. 使用自定义类名与 v-bind:class 4. 使用内联样式与 v-bind:style 5. 使用组件的 keep-alive 和条件渲染 在 Vue 2 中隐藏页面元素的方法 引言 在开发 Web 应用时&#xff0c;我们经…...