赞
踩
环境准备:
操作系统:centos7 以上版本x86_64
数据库:postgresql-13
postgis:postgis32_13.x86_64
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 postgresql13
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
sudo su - postgres
执行命令
psql
修改管理员的密码,然后\q再exit退出,
alter role postgres with password ‘你的密码’;
sudo vim /var/lib/pgsql/13/data/postgresql.conf
修改#listen_addresses = ‘localhost’ 为 listen_addresses=‘*’,去掉端口#,
输入wq!保存退出,也可以改为任何你想开放的服务器IP。
sudo vim /var/lib/pgsql/13/data/pg_hba.conf
文末加上:
host all all 0.0.0.0/0 md5
sudo firewall-cmd --add-port=5432/tcp --permanent sudo firewall-cmd
–reload
停止服务:sudo systemctl stop postgresql-13
重启服务:sudo systemctl start postgresql-13
通过navicat和pgAdmin4等就可以访问。
注意:如果安装过程中出现需要输入postgres 密码,则可以去相关目录下修改文件或执行下面操作:
sudo yum install epel-release
yum list postgis*
sudo yum install postgis32_13.x86_64
rpm -qi postgis32_13
sudo su - postgres psql
postgres=# create extension if not exists “uuid-ossp”;
postgres=#create extension postgis;
postgres=# create extension postgis_raster;
postgres=# create extension postgis_topology;
postgres=# create extension postgis_sfcgal; postgres=# create extension fuzzystrmatch;
postgres=# create extension address_standardizer;
postgres=# create extension address_standardizer_data_us;
postgres=# create extension postgis_tiger_geocoder;
postgres=# \dx
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。