Created
September 27, 2023 04:36
-
-
Save krishnaglodha/a529c329108d77099aba925a9f800b11 to your computer and use it in GitHub Desktop.
PostGIS Installation on ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add the PostgreSQL APT repository for the latest version | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
# Import the repository signing key | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
# Update the package list | |
sudo apt update | |
# Install PostgreSQL and PostGIS | |
sudo apt install -y postgresql postgresql-contrib postgis | |
# Enable the PostGIS extension in PostgreSQL | |
sudo -u postgres psql -c "CREATE EXTENSION postgis;" | |
# Optionally, enable the topology extension as well | |
sudo -u postgres psql -c "CREATE EXTENSION postgis_topology;" | |
# Restart PostgreSQL to apply the changes | |
sudo systemctl restart postgresql | |
echo "PostGIS has been installed and enabled." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment