postgresql13+postgis3.2

centos7.9 最简单的yum安装方法  打开官网有点慢 记录下 

安装gcc和g++包  (不是必须)

sudo yum -y install gcc gcc-c++ autoconf make  先装了gcc

PostgreSQL: Linux downloads (Red Hat family)  选择版本和系统

sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql13-server
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
sudo systemctl enable postgresql-13
sudo systemctl start postgresql-13

systemctl restart postgresql-13 重启

安装postgis

执行 yum install epel-release

执行 yum install postgis32_13.x86_64 ,安装postgis组件

注意 中间需要输入 y 确认
执行以上步骤后完成postgis安装

安装成功后可以利用命令查看安装信息

rpm -qi postgis32_13 或登录数据库 select postgis_version();

 

 

 按需执行

-- Enable PostGIS (as of 3.0 contains just geometry/geography)
CREATE EXTENSION postgis;
-- enable raster support (for 3+)
CREATE EXTENSION postgis_raster;
-- Enable Topology
CREATE EXTENSION postgis_topology;
-- Enable PostGIS Advanced 3D
-- and other geoprocessing algorithms
-- sfcgal not available with all distributions
CREATE EXTENSION postgis_sfcgal;
-- fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;
-- rule based standardizer
CREATE EXTENSION address_standardizer;
-- example rule data set
CREATE EXTENSION address_standardizer_data_us;
-- Enable US Tiger Geocoder
CREATE EXTENSION postgis_tiger_geocoder;

 

远程访问设置 

1、先修改密码

sudo -u postgres psql

alter user postgres password '1qaz2wsx';  修改为自己的密码

\q退出

2、修改/var/lib/pgsql/13/data 下的

postgresql.conf 文件 # - Connection Settings - 下的 listen_addresses = '*'

如需要修改端口 请去掉# 修改端口 和默认连接数

#port = 5432 # (change requires restart)
max_connections = 100 

3、修改/var/lib/pgs下的pg_hba.conf文件 IPv4

# IPv4 local connections:
host all all 0.0.0.0/0 md5

添加防火墙

firewall-cmd --permanent --add-port=5432/tcp  添加

firewall-cmd --reload 刷新

 

systemctl restart postgresql-13 重启 就可以连接测试了

 

posted @ 2022-10-08 15:43  没有想到好名字  阅读(496)  评论(0编辑  收藏  举报