From 38bb1dd989edbe811f15758a8be6fa6bdf072b65 Mon Sep 17 00:00:00 2001 From: Anastasia Alexandrova Date: Thu, 12 Oct 2023 21:13:29 +0200 Subject: [PATCH] DOCS-93 updated install PostGIS instructions (13) (#450) Added RHEL UBI steps modified: docs/solutions/postgis-deploy.md --- docs/solutions/postgis-deploy.md | 272 ++++++++++++++++++++++++------- 1 file changed, 213 insertions(+), 59 deletions(-) diff --git a/docs/solutions/postgis-deploy.md b/docs/solutions/postgis-deploy.md index 1378082aa..bc170f37b 100644 --- a/docs/solutions/postgis-deploy.md +++ b/docs/solutions/postgis-deploy.md @@ -2,7 +2,7 @@ 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/). @@ -10,28 +10,28 @@ The following document provides guidelines how to install PostGIS and how to run ## 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 ppg13 - ``` + 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 ppg13 + ``` - === "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 @@ -41,62 +41,216 @@ 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" + + 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 ppg13 + ``` + + 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 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 ppg13 + ``` + + 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 - 3. Enable the codeready builder repository to resolve dependencies conflict. For Red Hat Enterprise Linux 8 and derivatives, replace the version of the operating system in the following commands respectively. + 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. - === "RHEL 9" + ```{.bash data-prompt="$"} + $ sudo percona-release setup ppg13 + ``` + + 2. Install `epel` repository + + ```{.bash data-prompt="$"} + $ sudo yum install epel-release + ``` + + 3. Enable the `llvm-toolset dnf` module - ```{.bash data-prompt="$"} - $ sudo dnf config-manager --set-enabled codeready-builder-for-rhel-9-x86_64-rpms - ``` + ```{.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 + ``` - === "CentOS 9" + 5. Install the extension - ```{.bash data-prompt="$"} - $ sudo dnf config-manager --set-enabled crb - ``` + ```{.bash data-prompt="$"} + $ sudo yum install percona-postgis33 percona-postgis33-client + ``` - === "Oracle Linux 9" + === "Rocky Linux 9" - ```{.bash data-prompt="$"} - $ sudo dnf config-manager --set-enabled ol9_codeready_builder - ``` + 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 ppg13 + ``` + + 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 + ``` - === "Rocky Linux 9" + 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 - ``` + ```{.bash data-prompt="$"} + $ sudo dnf install dnf-plugins-core + $ sudo dnf config-manager --set-enabled powertools + ``` - 4. Install the extension + 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 yum install percona-postgis33 percona-postgis33-client - ``` + ```{.bash data-prompt="$"} + $ sudo percona-release setup ppg13 + ``` + + 4. Install `epel` repository + + ```{.bash data-prompt="$"} + $ sudo yum install epel-release + ``` + + 5. Disable the upstream `postgresql` package: - 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%'; - ``` + ```{.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%'; + ``` +## Enable PostGIS extension -3. 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: +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; @@ -104,13 +258,13 @@ 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 CREATE EXTENSION postgis; ``` -5. Check that the extension is enabled: +3. Check that the extension is enabled: ```sql SELECT postgis_full_version();