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

麒麟V10SP1部署postgresql+postgis+pgrouting

1、查看当前操作系统版本:

nkvers
############## Kylin Linux Version #################

Release:

Kylin Linux Advanced Server release V10 (Tercel)

Kernel:
4.19.90-17.5.ky10.aarch64

Build:
Kylin Linux Advanced Server
release V10 (SP1) /(Tercel)-aarch64-Build07/20200821
#################################################

2、安装依赖包

如果是无外网连接离线安装,先用:yum install –downloadonly [软件名称] –downloaddir=[指定rpm包存放路径] 下载好如下依赖包然后CP到服务器上运行RPM -IVH *.RPM,有外网连接直接运行如下命令:

yum install bzip*
yum install -y perl-ExtUtils-Embed
yum install -y flex
yum install -y bison
yum install -y readline-devel
yum install -y zlib-devel
yum install -y openssl-devel
yum install -y pam-devel
ryum install -y libxml2-devel
yum install -y libxslt-devel
yum install -y openldap-devel
yum install -y python-devel
yum install -y gcc-c++
yum install -y libssh2-devel
yum install cmake
yum install sqlite-devel

3、安装PostgreSQL

#下载源码包

wget http://ftp.postgresql.org/pub/source/v13.1/postgresql-13.1.tar.bz2

#解压源码包
tar xjvf postgresql-13.1.tar.bz2
#进入解压源码包目录
cd postgresql-13.1/
#配置编译
./configure –prefix=/opt/pgsql
#编译
gmake
#安装
gmake install

4、安装PostGIS依赖

因PostGIS依赖都无法通过YUM 源安装,因此只能通过源码安装:

4.1、#安装geos

wget http://download.osgeo.org/geos/geos-3.8.0.tar.bz2
tar -xjf geos-3.8.0.tar.bz2
cd geos-3.8.0
./configure –prefix=/opt/geos-3.8.0 –enable-python
make
sudo make install

4.2、#安装proj

wget https://download.osgeo.org/proj/proj-6.2.1.tar.gz
sudo apt-get install sqlite3
tar zxvf proj-6.2.1.tar.gz
cd proj-6.2.1
./configure –prefix=/opt/proj-6.2.1
make
sudo make install

4.3、#安装libxml2

wget ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz
tar zxvf libxml2-2.9.1.tar.gz
cd libxml2-2.9.1
./configure –prefix=/opt/libxml2-2.9.1
make
sudo make install

4.4、#安装json-c

git clone https://github.com/json-c/json-c.git
mkdir json-c-build
cd json-c-build
cmake …/json-c -DCMAKE_INSTALL_PREFIX=/opt/json-c
make
sudo make install

4.5、#安装 gdal

wget https://download.osgeo.org/gdal/3.3.3/gdal-3.3.3.tar.gz
tar zxvf gdal-3.3.3.tar.gz
cd gdal-3.3.3
./configure –prefix=/opt/gdal-3.3.3 –with-proj=/opt/proj-6.2.1 –with-libjson-c=/opt/json-c
make clean;make
sudo make install

编译过程中如报PNG错误,需修改代码:vi /gdal-3.3.3/frmts/png/libpng/pngpriv.h
在#ifndef PNG_ARM_NEON_OPT行上增加#define PNG_ARM_NEON_OPT 0

4.6、安装protobuf

下载源码
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.tar.gz
tar zxvf protobuf-all-3.6.1.tar.gz
cd protobuf-3.6.1
./configure –prefix=/opt/protobuf-3.6.1
make
sudo make install
#配置环境变量,增加/usr/local/protobuf-3.6.1安装目录
vi /etc/profile
export CMAKE_HOME=/usr/bin/cmake
export PKG_CONFIG_PATH=/opt/protobuf-3.6.1/lib/pkgconfig
export PROTOBUF_HOME=/opt/protobuf-3.6.1
export PATH=$CMAKE_HOME/bin:$PROTOBUF_HOME/bin:$PATH
#wq保存退出
source /etc/profile
#验证protobuf执行程序
protoc –version

4.7、#安装protobuf-c

wget https://github.com/protobuf-c/protobuf-c/releases/download/v1.4.0/protobuf-c-1.4.0.tar.gz
tar -zxvf protobuf-c-1.4.0.tar.gz
cd protobuf-c-1.4.0
#导入protobuf的pkgconfig,否则”–No package ‘protobuf’ found”
export PKG_CONFIG_PATH=/opt/protobuf-3.6.1/lib/pkgconfig
./configure –prefix=/opt/protobuf-c-1.4.0
make
make install
#配置环境变量,增加protobuf-c-1.4.0/bin
vi /etc/profile
export PATH=$PATH:/opt/protobuf-c-1.4.0/bin
#保存退出
source /etc/profile

5、安装PostGIS

#下载PostGIS源码

wget http://download.osgeo.org/postgis/source/postgis-3.1.6.tar.gz
tar zxvf postgis-3.1.6.tar.gz
cd postgis-3.1.6

./configure –prefix=/opt/postgis –with-gdalconfig=/opt/gdal-3.3.3/bin/gdal-config –with-pgconfig=/opt/pgsql/bin/pg_config –with-geosconfig=/opt/geos-3.8.0/bin/geos-config –with-projdir=/opt/proj-6.2.1/ –with-xml2config=/opt/libxml2-2.9.1/bin/xml2-config –with-jsondir=/opt/json-c –with-protobufdir=/opt/protobuf-c-1.4.0

注意:with前是两个-

make
make install
configrue 若提示版protobuf-c版本不对,需要手动修改configure脚本,增加版本变量值到configure文件。

6、安装pgRouting依赖

6.1、#安装CGAL

wget https://github.com/CGAL/cgal/archive/refs/tags/v5.5.1.tar.gz
tar -zxvf v5.5.1.tar.gz
cd cgal-5.5.1/
mkdir build

cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/cgal-5.5.1 …
make
make install

6.2、#安装BOOST

wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz
./bootstrap.sh –prefix=/opt/boost_1_81_0
./b2
sudo ./b2 install

7、安装pgRouting

wget https://github.com/pgRouting/pgrouting/releases/download/v3.4.2/pgrouting-3.4.2.tar.gz
tar -zxvf pgrouting-3.4.2.tar.gz
cd pgrouting-3.4.2
mkdir build
编辑环境配置文件vim /etc/profile
增加:export PATH=/opt/pgsql/bin/:$PATH
source /etc/profile
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/pgrouting-3.4.2 …
make
make install

8、测试PostGIS与pgRouting

#启动PostgreSQL
su postgres
pg_ctl -D /opt/pgsql/data start
#进入psql
/opt/pgsql/bin/psql

#创建PostgreSQL扩展
CREATE EXTENSION postgis;
CREATE EXTENSION pgrouting;
CREATE EXTENSION postgis_topology;
#列表列表插件
\dx
#检查插件版本
SELECT PostGIS_full_version();
select pgr_version();
#测试MVT
WITH mvtgeom AS
(
SELECT ST_TileEnvelope(12,513,412) AS geom
)
SELECT ST_AsMVT(mvtgeom.*)
FROM mvtgeom;


http://www.kler.cn/a/375388.html

相关文章:

  • Bluetooth Spec【0】蓝牙核心架构
  • C语言扫雷游戏教学(有图形界面)(提供源码+实验报告)(计时+排行榜+难度选择+登录注册+背景音乐)(涉及easyX库)
  • Cline 3.0发布:从AI编程助手到通用智能体平台的进化
  • DP动态规划(装箱问题)
  • 学习“Kotlin编程指南”笔记
  • JAVA:组合模式(Composite Pattern)的技术指南
  • 从同样一个简单的计算问题,看星火4.0 Turbo模型推理逻辑能力
  • 小张求职记二:完善简历
  • 【CSS】——基础入门常见操作
  • 如何在 Ubuntu 16.04 上使用 UFW 设置防火墙
  • VsCode显示空格
  • 移远通信推出八款天线新品,覆盖5G、4G、Wi-Fi和LoRa领域
  • const对象仅在文件内有效的问题
  • 探讨Facebook的AI研究:未来社交平台的技术前瞻
  • 机器视觉中光源镜头和相机的关系
  • Django数据模型on_delete属性值
  • 大厂面试真题-很多系统会使用netty进行长连接,连接太多会有问题吗
  • Linux中部署PostgreSQL保姆级教程
  • 实习冲刺Day10
  • 【CSS】CSS 样式重置 (normalize.css 和 reset.css) 和通用样式配置
  • 虚拟现实与增强现实:重塑娱乐和教育的边界!
  • Pytest-Bdd-Playwright 系列教程(6):在测试步骤函数中设置别名数据共享
  • 校园社团信息管理:Spring Boot技术的优势与实现
  • 提升用户体验优化全攻略
  • !!!Docker 实践与应用实例
  • vue系列==vue3新语法