CentOS7 use yum install PostgreSQL and PostGIS

  1. Yum update source
    CentOS7 default yum source PostgreSQL version is too low, not suitable for use in this version. In https://yum.postgresql.org/repopackages.php find a suitable CentOS7 on the RPM source, copy its url address, use yum install.
    Install epel (Extra Packages for Enterprise Linux 7 ), for stability, the default yum source CentOS7 missing a lot of components that can be found on epel.
    command:
    yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
    yum -y install epel-release

  2. PostgreSQL installation
    using the yum search postgrecommand to see multiple versions of PostgreSQL, here I chose PostgreSQL10.
    yum install -y postgresql10-server postgresql10-contrib
    Initialization
    /usr/pgsql-10/bin/postgresql10-setup initdb
    Set boot
    systemctl enable postgresql-10
    to start the database
    systemctl start postgresql-10
  3. Configuration database
    configuration for remote access, edit /var/lib/pgsql/10/data/postgresql.conf, find listen_addresses, if you want to be open to all IP, the value listen_addresses changed to '*', if only open for part of the IP, between multiple IP with a ,separated (comma and space).
    Configuring account access, edit /var/lib/pgsql/10/data/pg_hba.conf, file is divided into five, namely, TYPE, DATABASE, USER, ADDRESS, METHOD, you can set access permissions for users of different databases in different IP addresses. METHOD Analytical last column as follows:
    Trust any connection is allowed, no password
    reject rejected Matching (front several conditions) Request
    MD5 MD5 receiving a password encrypted
    password to log receiving a password, use only trusted network in this way
    gss use gssapi certification, only available in connection tcp / ip
    SSPI is only one way windows available
    krb5 not commonly used, only TCP / IP is available
    using the operating system user authentication ident, verify that it meets the requests of the database username
    ldap server using LDAP authentication
    cert using ssl client authentication
    pam pam module using the operating system's service
    if required all IP are using a login password is configured host all all 0.0.0.0/0 md5.
  4. PostGIS installation
    using the yum search postgiscommand to see multiple versions of PostGIS, here I choose postgis25, yum install -y postgis25_10, switch to the postgres user after installation, open the extension.
// 开启插件  
# su postgres  
# psql  
// 开启pgsql的插件  
postgres=# create extension postgis;  
postgres=# create extension postgis_topology;  
postgres=# create extension fuzzystrmatch;  
postgres=# create extension address_standardizer;  
postgres=# create extension address_standardizer_data_us;  
postgres=# create extension postgis_tiger_geocoder;  

So far, PostgreSQL and PostGIS installed.

Reference Site

http://postgis.net/install/
https://blog.csdn.net/weixin_34150830/article/details/92529479
https://www.cnblogs.com/xulingjie/p/9605472.html
https://www.cnblogs.com/EasonJim/p/9023607.html

Guess you like

Origin www.cnblogs.com/sunnyeveryday/p/11442332.html