Skip to content

Commit

Permalink
DOCS-93 updated install PostGIS instructions (11) (#452)
Browse files Browse the repository at this point in the history
Added RHEL UBI steps

modified:   docs/solutions/postgis-deploy.md
  • Loading branch information
nastena1606 authored Oct 13, 2023
1 parent 36a5ff1 commit 6136bdb
Showing 1 changed file with 217 additions and 60 deletions.
277 changes: 217 additions & 60 deletions docs/solutions/postgis-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -40,75 +40,232 @@ 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;
\c nyc;
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();
Expand Down

0 comments on commit 6136bdb

Please sign in to comment.