快速且靠譜的簡單安裝 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.pswp.cn/web/63048.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/63048.shtml
英文地址,請注明出處:http://en.pswp.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;…