pg_yum版安装

yum版常用操作命令

su - postgres 	# 切换到用户postgres
/usr/pgsql-10/bin/initdb -D /var/lib/pgsql/10/data/	# 初始化数据库
/usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data/ -l logfile start	# 启动数据库
/usr/pgsql-10/bin/psql postgres postgres	# 登录
tail -f /var/lib/pgsql/logfile   #查看日志

转载地址

https://github.com/Vonng/pg/blob/master/tools/postgis-install.md

安装环境

CentOS 7
PostgreSQL10
PostGIS2.4

PostgreSQL10安装

安装正确的rpm包

你可以从 http://yum.postgresql.org/repopackages.php获取相应的平台链接
在这里插入图片描述

https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

github下载地址为 https://github.com/maqingbin8888/writeWord/blob/master/writeWord/resources/pgdg-redhat-repo-latest.noarch.rpm

安装正确的rpm包

rpm -ivh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

查看rpm包是否正确安装

yum list | grep pgdg

安装PG

yum install -y postgresql10 postgresql10-server postgresql10-libs postgresql10-contrib postgresql10-devel

启动服务

默认情况下,PG安装目录为/usr/pgsql-10/,data目录为/var/lib/pgsql/,系统默认创建用户postgres

passwd postgres # 为系统postgres设置密码
su - postgres 	# 切换到用户postgres
/usr/pgsql-10/bin/initdb -D /var/lib/pgsql/10/data/	# 初始化数据库
/usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data/ -l logfile start	# 启动数据库
/usr/pgsql-10/bin/psql postgres postgres	# 登录

PostGIS安装

yum install postgis24_10-client postgis24_10

如果遇到错误如下:

--> 解决依赖关系完成
错误:软件包:postgis24_10-client-2.4.2-1.rhel7.x86_64 (pgdg10)
          需要:libproj.so.0()(64bit)
错误:软件包:postgis24_10-2.4.2-1.rhel7.x86_64 (pgdg10)
          需要:gdal-libs >= 1.9.0

你可以尝试通过以下命令解决:

yum -y install epel-release

fdw安装

yum install ogr_fdw10

pgrouting安装

yum install pgrouting_10

验证测试

# 登录pg后执行以下命令,无报错则证明成功
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION ogr_fdw;

SELECT postgis_full_version();

Centos: postgres-decoderbufs

前提是 pg与postgis都成功的安装好并且检测通过后

protobuf

百度云下载地址为
链接:https://pan.baidu.com/s/1JwhMihKnlUZ2MHqi1fiKqQ
鸡和马:jxul

cd /usr/local
wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
tar xvf protobuf-2.6.1.tar.gz
cd protobuf-2.6.1
./configure
make
make check
make install
cd ..

protobuf-c

百度云下载地址为
链接:https://pan.baidu.com/s/1_QdbHQYIfw5rPrfBL_IUhw
鸡和马:4z2m

wget https://github.com/protobuf-c/protobuf-c/releases/download/v1.2.1/protobuf-c-1.2.1.tar.gz
tar xvf protobuf-c-1.2.1.tar.gz
cd protobuf-c-1.2.1
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig // 指定protobuf.pc文件所在
./configure
make
make install

decoderbufs(这里用的debezium的postgres-decoderbufs)

百度云的源码下载地址为:链接:https://pan.baidu.com/s/1ChO6M5Q7MiaFm3Q5ZShTew
鸡和马:2x2b
先配置环境变量

vi /etc/profile
#/usr/pgsql-10/bin/里的pg_config
export   PATH=/usr/pgsql-10/bin/:${PATH}
保存之后
source /etc/profile

再进行安装postgres-decoderbufs

cd /usr/local
git clone https://github.com/debezium/postgres-decoderbufs.git
cd postgres-decoderbufs
make & make install

修改postgresql.conf

/var/lib/pgsql/10/data/postgresql.conf

找到 shared_preload_libraries = ‘’
改成 shared_preload_libraries = ‘decoderbufs’
然后重启pg数据库

su - postgres
/usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data/ -l logfile restart	#重启动数据库

附:postgis源码安装

postgis源码安装非常复杂
可以参考的文章如下
https://www.jianshu.com/p/e08dbc60a3b2

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值