CentOS7 Method for installing PostgreSQL and PostGIS using yum
- 2021-07-03 01:19:02
- OfStack
1. Update the yum source
The PostgreSQL version of the CentOS7 default yum source is too low to be used on this version. Find the RPM source suitable for CentOS7 on https://yum.postgresql.org/repopackages.php, copy its url address, and install it using yum.
Install epel at the same time (Extra Packages for Enterprise Linux 7). For stability, the default yum source of CentOS 7 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.rpm
yum -y install epel-release
2. Install PostgreSQL
Use yum search postgre Command can see multiple versions of the PostgreSQL Here I choose PostgreSQL10 .
yum install -y postgresql10-server postgresql10-contrib
Initialization
/usr/pgsql-10/bin/postgresql10-setup initdb
Set up startup
systemctl enable postgresql-10
Start the database
systemctl start postgresql-10
3. Configure the database
Configure host all all 0.0. 0.0 md5 if all IP are required to login with a password.
4. Install PostGIS
You can see multiple versions of PostGIS by using yum search postgis command. Here I select postgis25, yum install-y postgis25_10. After installation, I switch to postgres user and start extension.
// Open plug-in
# su postgres
# psql
// Open pgsql Plug-ins of
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;
At this point, PostgreSQL and PostGIS are installed.
Summarize
Above is this site to introduce you to CentOS7 yum installation PostgreSQL and PostGIS, I hope to help you, if you have any questions welcome to leave me a message, this site will reply to you in time!