From 6136bdba69a70b0abd064050f3b108cc9cb3c164 Mon Sep 17 00:00:00 2001 From: Anastasia Alexandrova Date: Fri, 13 Oct 2023 10:05:00 +0200 Subject: [PATCH] DOCS-93 updated install PostGIS instructions (11) (#452) Added RHEL UBI steps modified: docs/solutions/postgis-deploy.md --- docs/solutions/postgis-deploy.md | 277 ++++++++++++++++++++++++------- 1 file changed, 217 insertions(+), 60 deletions(-) diff --git a/docs/solutions/postgis-deploy.md b/docs/solutions/postgis-deploy.md index 5a5525a29..8ab734ef3 100644 --- a/docs/solutions/postgis-deploy.md +++ b/docs/solutions/postgis-deploy.md @@ -2,35 +2,35 @@ The following document provides guidelines how to install PostGIS and how to run the basic queries. -## Preconditions +## Considerations 1. We assume that you have the basic knowledge of spatial data, GIS (Geographical Information System) and of shapefiles. 2. For uploading the spatial data and querying the database, we use the same [data set](https://s3.amazonaws.com/s3.cleverelephant.ca/postgis-workshop-2020.zip) as is used in [PostGIS tutorial](http://postgis.net/workshops/postgis-intro/) ## Install PostGIS -1. Enable Percona repository. +=== "On Debian and Ubuntu" - As other components of Percona Distribution for PostgreSQL, PostGIS is available from Percona repositories. Use the [`percona-release`](https://docs.percona.com/percona-software-repositories/installing.html) repository management tool to enable the repository. + 1. Enable Percona repository - ```{.bash data-prompt="$"} - $ sudo percona-release setup ppg11 - ``` + As other components of Percona Distribution for PostgreSQL, PostGIS is available from Percona repositories. Use the [`percona-release`](https://docs.percona.com/percona-software-repositories/installing.html) repository management tool to enable the repository. -2. Install PostGIS packages + ```{.bash data-prompt="$"} + $ sudo percona-release setup ppg11 + ``` - === "On Debian and Ubuntu" + 2. Install PostGIS packages - ```{.bash data-prompt="$"} - $ sudo apt install percona-postgis - ``` + ```{.bash data-prompt="$"} + $ sudo apt install percona-postgis + ``` - This installs the set of PostGIS extensions. To check what extensions are available, run the following query from the `psql` terminal: + 3. The command in the previous step installs the set of PostGIS extensions. To check what extensions are available, run the following query from the `psql` terminal: - ```sql - SELECT name, default_version,installed_version - FROM pg_available_extensions WHERE name LIKE 'postgis%' or name LIKE 'address%'; - ``` + ```sql + SELECT name, default_version,installed_version + FROM pg_available_extensions WHERE name LIKE 'postgis%' or name LIKE address%'; + ``` !!! note @@ -40,60 +40,217 @@ The following document provides guidelines how to install PostGIS and how to run $ sudo apt-get install libsfcgal1 ``` - === "On RHEL and derivatives" - - 1. Install `epel` repository - - ```{.bash data-prompt="$"} - $ sudo yum install epel-release - ``` +=== "On RHEL and derivatives" - 2. Enable the `llvm-toolset dnf` module - - ```{.bash data-prompt="$"} - $ sudo dnf module enable llvm-toolset - ``` + For Red Hat Enterprise Linux 8 and derivatives, replace the operating system version in the following commands accordingly. + + === "RHEL 9" - 3. Enable the codeready builder repository to resolve dependencies conflict. + 1. Enable Percona repository - === "RHEL 9" + As other components of Percona Distribution for PostgreSQL, PostGIS is available from Percona repositories. Use the [`percona-release`](https://docs.percona.com/percona-software-repositories/installing.html) repository management tool to enable the repository. - ```{.bash data-prompt="$"} - $ sudo dnf config-manager --set-enabled codeready-builder-for-rhel-9-x86_64-rpms - ``` + ```{.bash data-prompt="$"} + $ sudo percona-release setup ppg11 + ``` - === "CentOS 9" + 2. Install `epel` repository - ```{.bash data-prompt="$"} - $ sudo dnf config-manager --set-enabled crb - ``` + ```{.bash data-prompt="$"} + $ sudo yum install epel-release + ``` - === "Oracle Linux 9" + 3. Enable the `llvm-toolset dnf` module - ```{.bash data-prompt="$"} - $ sudo dnf config-manager --set-enabled ol9_codeready_builder - ``` - - === "Rocky Linux 9" - ```{.bash data-prompt="$"} - $ sudo dnf install dnf-plugins-core - $ sudo dnf config-manager --set-enabled powertools - ``` + ```{.bash data-prompt="$"} + $ sudo dnf module enable llvm-toolset + ``` + + 4. Enable the codeready builder repository to resolve dependencies conflict. + + ```{.bash data-prompt="$"} + $ sudo dnf config-manager --set-enabled codeready-builder-for-rhel-9-x86_64-rpms + ``` + + 5. Install the extension + + ```{.bash data-prompt="$"} + $ sudo yum install percona-postgis33 percona-postgis33-client + ``` + + === "CentOS 9" + + 1. Enable Percona repository + + As other components of Percona Distribution for PostgreSQL, PostGIS is available from Percona repositories. Use the [`percona-release`](https://docs.percona.com/percona-software-repositories/installing.html) repository management tool to enable the repository. + + ```{.bash data-prompt="$"} + $ sudo percona-release setup ppg11 + ``` + + 2. Install `epel` repository + + ```{.bash data-prompt="$"} + $ sudo yum install epel-release + ``` + + 3. Enable the `llvm-toolset dnf` module + + ```{.bash data-prompt="$"} + $ sudo dnf module enable llvm-toolset + ``` + + 4. Enable the codeready builder repository to resolve dependencies conflict. + + ```{.bash data-prompt="$"} + $ sudo dnf config-manager --set-enabled crb + ``` + + 5. Install the extension + + ```{.bash data-prompt="$"} + $ sudo yum install percona-postgis33 percona-postgis33-client + ``` + + === "Oracle Linux 9" + + 1. Enable Percona repository + + As other components of Percona Distribution for PostgreSQL, PostGIS is available from Percona repositories. Use the [`percona-release`](https://docs.percona.com/percona-software-repositories/installing.html) repository management tool to enable the repository. + + ```{.bash data-prompt="$"} + $ sudo percona-release setup ppg11 + ``` + + 2. Install `epel` repository + + ```{.bash data-prompt="$"} + $ sudo yum install epel-release + ``` + + 3. Enable the `llvm-toolset dnf` module + + ```{.bash data-prompt="$"} + $ sudo dnf module enable llvm-toolset + ``` + + 4. Enable the codeready builder repository to resolve dependencies conflict. + + ```{.bash data-prompt="$"} + $ sudo dnf config-manager --set-enabled ol9_codeready_builder + ``` + + 5. Install the extension + + ```{.bash data-prompt="$"} + $ sudo yum install percona-postgis33 percona-postgis33-client + ``` + + === "Rocky Linux 9" + + 1. Enable Percona repository + + As other components of Percona Distribution for PostgreSQL, PostGIS is available from Percona repositories. Use the [`percona-release`](https://docs.percona.com/percona-software-repositories/installing.html) repository management tool to enable the repository. + + ```{.bash data-prompt="$"} + $ sudo percona-release setup ppg11 + ``` + + 2. Install `epel` repository + + ```{.bash data-prompt="$"} + $ sudo yum install epel-release + ``` + + 3. Enable the `llvm-toolset dnf` module + + ```{.bash data-prompt="$"} + $ sudo dnf module enable llvm-toolset + ``` + + 4. Enable the codeready builder repository to resolve dependencies conflict. + + ```{.bash data-prompt="$"} + $ sudo dnf install dnf-plugins-core + $ sudo dnf config-manager --set-enabled powertools + ``` - 4. Install the extension - ```{.bash data-prompt="$"} - $ sudo yum install percona-postgis33 percona-postgis33-client - ``` + 5. Install the extension + + ```{.bash data-prompt="$"} + $ sudo yum install percona-postgis33 percona-postgis33-client + ``` + + === "RHEL UBI 9" + + 1. Configure the Oracle-Linux repository. Create the `/etc/yum.repos.d/oracle-linux-ol9.repo` file to install the required dependencies: + + ```init title="/etc/yum.repos.d/oracle-linux-ol9.repo" + [ol9_baseos_latest] + name=Oracle Linux 9 BaseOS Latest ($basearch) + baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/baseos/latest/$basearch/ + gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle + gpgcheck=1 + enabled=1 + + [ol9_appstream] + name=Oracle Linux 9 Application Stream ($basearch) + baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/appstream/$basearch/ + gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle + gpgcheck=1 + enabled=1 + + [ol9_codeready_builder] + name=Oracle Linux 9 CodeReady Builder ($basearch) - Unsupported + baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/codeready/builder/$basearch/ + gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle + gpgcheck=1 + enabled=1 + ``` + + 2. Download the right GPG key for the Oracle Yum Repository: + + ```{.bash data-prompt="$"} + $ wget https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle + ``` + + 3. Enable Percona repository + + As other components of Percona Distribution for PostgreSQL, PostGIS is available from Percona repositories. Use the [`percona-release`](https://docs.percona.com/percona-software-repositories/installing.html) repository management tool to enable the repository. + + ```{.bash data-prompt="$"} + $ sudo percona-release setup ppg11 + ``` + + 4. Install `epel` repository + + ```{.bash data-prompt="$"} + $ sudo yum install epel-release + ``` + + 5. Disable the upstream `postgresql` package: + + ```{.bash data-prompt="$"} + $ sudo dnf module disable postgresql + ``` + + 6. Install the extension + + ```{.bash data-prompt="$"} + $ sudo yum install percona-postgis33 percona-postgis33-client + ``` + + This installs the set of PostGIS extensions. To check what extensions are available, run the following query from the `psql` terminal: + + ```sql + SELECT name, default_version,installed_version + FROM pg_available_extensions WHERE name LIKE 'postgis%' or name LIKE 'address%'; + ``` - This installs the set of PostGIS extensions. To check what extensions are available, run the following query from the `psql` terminal: - - ```sql - SELECT name, default_version,installed_version - FROM pg_available_extensions WHERE name LIKE 'postgis%' or name LIKE 'address%'; - ``` +## Enable PostGIS extension -3. Create a database and a schema to store your data for this database. A schema is a container that logically segments objects (tables, functions, views, and so on) for better management. Run the following commands from the `psql` terminal +1. Create a database and a schema for this database to store your data. A schema is a container that logically segments objects (tables, functions, views, and so on) for better management. Run the following commands from the `psql` terminal: ```sql CREATE DATABASE nyc; @@ -101,14 +258,14 @@ The following document provides guidelines how to install PostGIS and how to run CREATE SCHEMA gis; ``` -4. To make PostGIS functions and operations work, you need to enable the `postgis` extension. Make sure you are connected to the database you created earlier and run the following command: +2. To make PostGIS functions and operations work, you need to enable the `postgis` extension. Make sure you are connected to the database you created earlier and run the following command: ```sql \c nyc; CREATE EXTENSION postgis; ``` -5. Check that the extension is enabled: +3. Check that the extension is enabled: ```sql SELECT postgis_full_version();