Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install PostgreSQL and PostGIS using yum in CentOS7

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Today, I would like to share with you how CentOS7 uses yum to install PostgreSQL and PostGIS. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.

1. Update yum Feed

The postgresql version of the centos7 default yum source is too low to be used in this release. Find the rpm source suitable for centos7 on the, copy its url address, and install using yum.

Also install epel (extra packages for enterprise linux 7). For stability, the default yum source for centos7 lacks many components, which 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.rpmyum-y install epel-release

two。 Install postgresql

You can see multiple versions of postgresql using the yum search postgre command, and I chose postgresql10 here. Yum install-y postgresql10-server postgresql10-contrib initialization / usr/pgsql-10/bin/postgresql10-setup initdb setup boot systemctl enable postgresql-10 boot database systemctl start postgresql-10

3. Configuration database

Configure remote access, edit / var/lib/pgsql/10/data/postgresql.conf, find listen_addresses, if you want to be open to all ip, change the value of listen_addresses to'*', if only for part of ip, separate multiple ip with commas and spaces.

Configure account access permissions and edit / var/lib/pgsql/10/data/pg_hba.conf. The file is divided into five columns, namely type, database, user, address and method. You can set different database access permissions for users with different ip addresses. The last column of method is parsed as follows:

Trust allows any connection, no password required

Reject rejects requests that meet the criteria (the previous conditions)

Md5 receives a password encrypted by md5

Password receives a password to log in, using this method only on trusted networks

Gss uses gssapi authentication and is only available on tcp/ip connections

Sspi is only available in windows in one way

Krb5 is not commonly used and is only available on tcp/ip

Ident uses the operating system user name authentication to verify that it matches the requested database user name

Ldap uses ldap server authentication

Cert uses ssl client authentication

Pam uses pam module services of the operating system

If all ip are required to log in with a password, configure to host all all 0.0.0.0 md5.

4. Install postgis

You can see multiple versions of postgis using the yum search postgis command. Here I choose postgis25,yum install-y postgis25_10, switch to postgres user after installation, and enable the extension.

/ / Open the plug-in # su postgres # psql / / Open the plug-in 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; of pgsql. These are all the contents of the article "how to install PostgreSQL and PostGIS with CentOS7 using yum". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report