【Postgresql】有手就行yum安装Postgresql12+Postgis3.0

安装pgdg库

直接yum install会提示no packege
所以先要安装这个库

https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7.5-x86_64/pgdg-redhat-repo-latest.noarch.rpm
rpm -ivh pgdg-redhat-repo-latest.noarch.rpm

安装Postgresql

可以选版本,改变数字就行

yum -y install postgresql10-server postgresql10

Postgresql-12

yum -y install postgresql12-server postgresql12
su - postgres

初始化数据库 -D 指定目录

/usr/pgsql-12/bin/initdb -D /home/postgresql/data -U postgres

启动数据库

/usr/pgsql-12/bin/pg_ctl -D /homeplus/postgresql/data -l logfile start

进入数据库

psql

安装Postgis

yum -y install epel-release
yum -y install postgis30_12 postgis30_12-utils postgis30_12-client

创建扩展

psql -d yourdatabase -c "CREATE EXTENSION postgis;"

-- if you built with raster support and want to install it --
psql -d yourdatabase -c "CREATE EXTENSION postgis_raster;"

-- if you want to install topology support --
psql -d yourdatabase -c "CREATE EXTENSION postgis_topology;"

-- if you built with sfcgal support and want to install it --
psql -d yourdatabase -c "CREATE EXTENSION postgis_sfcgal;"

-- if you want to install tiger geocoder --
psql -d yourdatabase -c "CREATE EXTENSION fuzzystrmatch"
psql -d yourdatabase -c "CREATE EXTENSION postgis_tiger_geocoder;"

-- if you installed with pcre
-- you should have address standardizer extension as well
psql -d yourdatabase -c "CREATE EXTENSION address_standardizer;"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值