1.按照postgresql官网说明安装postgresql
https://www.postgresql.org/download/linux/redhat/
postgresql10的安装说明如下:
# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install PostgreSQL:
sudo yum install -y postgresql10-server
# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
sudo systemctl enable postgresql-10
sudo systemctl start postgresql-10
2.修改postgres密码
su – postgres
psql
ALTER USER postgres WITH PASSWORD ‘postgres’;
3. 修改配置文件,信任远程连接
vi /var/lib/pgsql/10/data/pg_hba.conf
修改之前:
修改之后:
4. 修改配置文件,开启远程访问
vi /var/lib/pgsql/10/data/postgresql.conf
修改之前:
修改之后:
5.重启生效
systemctl restart postgresql-10.service
至此,postgresql安装完成,以下为postgis安装步骤。
6.安装epel
yum -y install epel-release
7.安装postgis
yum install postgis30_10
8. 开启pgsql的插件
su postgres
psql
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION postgis_sfcgal;
CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION address_standardizer;
CREATE EXTENSION address_standardizer_data_us;
CREATE EXTENSION postgis_tiger_geocoder;
CREATE EXTENSION pgrouting;
CREATE EXTENSION postgis_raster;
至此,全部安装完成。