October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Install and Configure PostGIS on a Linux VPS

Install PostGIS correctly on an Ubuntu or Debian VPS by matching the package to PostgreSQL's major version, selecting distribution packages or PGDG, enabling the extension in a dedicated database, and verifying the running cluster with SQL.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install PostGIS as a package matched to the PostgreSQL major running on your VPS, then enable it separately in the application database that will store spatial data. On Ubuntu or Debian, the reliable sequence is: identify the operating system and cluster, choose distribution packages or PGDG, install postgresql-<major>-postgis-3, inspect clusters with pg_lsclusters, run CREATE EXTENSION postgis; in a dedicated database, and verify the result with SQL.

What PostGIS installation actually involves

PostGIS is a PostgreSQL extension, not a separate database server. The server package must match the PostgreSQL major version that owns the cluster you intend to use. For example, the PostGIS documentation pairs PostgreSQL 18 with postgresql-18-postgis-3. If your server runs PostgreSQL 16, install postgresql-16-postgis-3 instead; do not choose a package merely because it is the newest one visible in the repository.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There are two separate operations:

  • Operating-system installation: install the PostgreSQL server and the PostGIS packages with APT.
  • Database enablement: connect to each database that needs spatial types and run CREATE EXTENSION postgis;.

Installing the package does not automatically enable PostGIS in every database. Conversely, running CREATE EXTENSION cannot succeed when the matching files are absent from the server.

Before you install: identify the VPS and PostgreSQL major

Confirm the Linux release and architecture

Ubuntu and Debian publish different supported-release and architecture lists. Record the release codename and CPU architecture before selecting a repository. On a shell, these checks provide the information you need:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
cat /etc/os-release
uname -m

Use the codename reported by the VPS itself when configuring a repository. Do not copy an example codename from a different Ubuntu or Debian release. Architecture matters too: a package repository must publish binaries for the VPS architecture.

Find the PostgreSQL cluster that will serve the application

Debian-style packages can keep several PostgreSQL major versions installed at the same time. Each major can have its own cluster, name, status and port. List them before installing or connecting:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
pg_lsclusters

The output identifies the running major, cluster name, status and listening port. Keep those four values with the database name in your deployment notes. They prevent a common failure in which PostGIS is installed for one major while the application connects to another cluster.

Choose Ubuntu/Debian packages or the PGDG repository

Use the distribution repository when its PostgreSQL major and extension packages meet the application’s support requirements. Use the PostgreSQL Global Development Group (PGDG) repository when the distribution snapshot does not provide the required major or when you need a supported PostgreSQL version supplied by PGDG.

Decision point Distribution packages PGDG packages
PostgreSQL major availability Limited to the versions published for that Ubuntu or Debian release. Provides supported PostgreSQL versions beyond the distribution snapshot.
Package naming Use the versioned PostgreSQL and PostGIS package names available for the release. Package names include the PostgreSQL major, such as postgresql-18 and postgresql-18-postgis-3.
Lifecycle and support Follows the operating system’s package and maintenance window. Follows the major versions and support policy published by PGDG.
Architecture Must be available for the VPS architecture in the Ubuntu/Debian repository. Must be available for the VPS architecture in the PGDG repository.
Best fit A standard VPS that can use the release’s packaged PostgreSQL major. An application that requires a different major or extension availability than the OS snapshot offers.

Whichever source you select, make the PostgreSQL major an explicit decision. The server package, PostGIS package, cluster, connection port and application configuration must all refer to the same major.

Configure PGDG when the distribution major is not suitable

Automated setup

The documented automated setup installs the PostgreSQL packaging helper and runs its repository configuration script:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh

The script configures the PGDG APT source for the VPS. After it completes, refresh package metadata before installing the selected major.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Manual repository setup

Manual setup requires the repository prerequisites, the PGDG signing key, a source definition under /etc/apt/sources.list.d/pgdg.sources, and an APT update. Install curl and ca-certificates, import the signing key using the procedure documented by PostgreSQL, and set the source to the VPS’s exact distribution codename with the -pgdg suffix. Do not substitute a codename from another release, and do not omit the architecture restriction when the repository instructions require one.

Once the source file is in place, run:

sudo apt update

Check the APT output for repository or signature errors before proceeding. A failed update means package selection is not trustworthy; fix the source definition or key problem first.

Install PostgreSQL and PostGIS

Install a versioned server and PostGIS package

For PostgreSQL 18, the PostGIS installation guide gives this sequence:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt update
sudo apt install postgresql-18 postgresql-18-postgis-3
sudo apt install postgis

Replace 18 with the major you selected. The versioned package, postgresql-<major>-postgis-3, supplies the server-side extension files for that major. The unversioned postgis package supplies command-line utilities such as shp2pgsql and raster2pgsql. Those tools are useful for loading shapefiles and raster data, but installing them does not enable the extension in a database.

Check which cluster was created or started

Run the cluster listing again after installation:

pg_lsclusters

Confirm that the expected major is online, note its cluster name and port, and use those values for the first connection. If another major was already installed, the new package may create a second cluster rather than changing the one your application currently uses.

Create a dedicated spatial database

PostGIS documentation advises against installing the extension in the default postgres maintenance database. Create a user database for the application instead. Connect as the PostgreSQL administrator (or an equivalent privileged role) and run:

CREATE DATABASE gisdb;
connect gisdb
CREATE EXTENSION postgis;

In a typical Debian or Ubuntu installation, an administrator can open the SQL prompt with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
sudo -u postgres psql

If the desired cluster is not the default connection target, specify the cluster’s port and database explicitly with your normal psql connection options. The important point is that CREATE EXTENSION must execute inside gisdb, on the same cluster whose matching PostGIS package you installed.

What enablement changes

PostGIS registers spatial data types, functions and metadata in the database where the command runs. Enabling it in gisdb does not enable it in another database on the same cluster. If an application uses several databases, repeat the enablement step in each one that stores spatial data.

Add optional PostGIS modules only when needed

The core postgis extension is the normal starting point. Optional modules are separate extensions and should be enabled only for a documented application requirement:

CREATE EXTENSION postgis_raster;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION postgis_sfcgal;
  • postgis_raster adds raster functionality.
  • postgis_topology adds topology support.
  • postgis_sfcgal enables functionality that depends on SFCGAL.

These commands also run inside the target database. Installing every optional module by habit increases the objects and dependencies you must maintain without helping an application that does not use them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify that PostGIS is available and enabled

Check the installed build

In the target database, run:

SELECT postgis_full_version();

The result reports the PostGIS build associated with the current database and server. Save it with the PostgreSQL major, cluster name and port when diagnosing deployments or planning an upgrade.

Check extension availability

Also query PostgreSQL’s extension catalog:

SELECT * FROM pg_available_extensions WHERE name = 'postgis';

This query tells you whether PostgreSQL can see the PostGIS extension files. A row with an available version confirms that the package is visible to the connected server. The presence of that row is distinct from whether the extension has already been created in the current database.

Interpret the two checks together

Result Meaning Next action
postgis_full_version() returns a version and the catalog query returns a row PostGIS is installed and enabled in the connected database. Proceed with application schema and spatial data setup.
The catalog query returns a row, but postgis_full_version() fails The package is installed for this server, but the extension has not been created in this database, or you connected to a different database than expected. Connect to the application database and run CREATE EXTENSION postgis;.
The catalog query returns no row The connected server cannot see a matching PostGIS package. Check the running major and install its postgresql-<major>-postgis-3 package.

Configuration locations and operational records

APT-installed PostgreSQL configuration is organized below /etc/postgresql/<major>/main on Ubuntu and Debian. The PostGIS administration guidance identifies the cluster environment file as the preferred location for environment settings on these installations. Keep environment changes there rather than scattering them across shell profiles that service processes may never read.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Document the following as one connection record:

  • Linux distribution and release codename
  • CPU architecture
  • PostgreSQL major
  • Cluster name and status
  • Listening port
  • Application database name
  • Extensions enabled in that database

This record is especially important when multiple PostgreSQL majors coexist. It also makes package upgrades safer: you can compare the package major with the cluster major before changing either one.

Managed PostgreSQL VPS: a different installation path

A managed PostgreSQL service may already have PostGIS installed on its servers. In that situation, do not install operating-system packages yourself. First inspect the provider’s supported extension list or service documentation. If PostGIS is available, connect to the target database with a superuser or the privileged role the provider permits and run:

CREATE EXTENSION postgis;

Run the verification queries afterward. A managed service can restrict extension creation even when the files are present, so a permission error is a provider privilege issue rather than evidence that the package is missing. The provider’s documented PostgreSQL major and extension availability take precedence over self-managed APT instructions.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the errors that occur most often

extension "postgis" is not available

This means the connected PostgreSQL server cannot find the extension files. Run pg_lsclusters and note the major of the cluster you actually reached. Then compare it with the package installed on the VPS. Install the exact matching package, for example postgresql-18-postgis-3 for a PostgreSQL 18 cluster, refresh the package index if necessary, and rerun the availability query.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A frequent cause is installing the package for one major while connecting to another. Installing postgresql-18-postgis-3 does not make PostGIS available to a PostgreSQL 16 cluster.

permission denied from CREATE EXTENSION

Extension creation requires a superuser or a role that the managed provider explicitly permits to create extensions. Reconnect with the PostgreSQL administrator on a self-managed VPS, or follow the provider’s privileged-role procedure on a managed service. Do not work around the error by placing application objects in the maintenance database.

You connected to the wrong cluster or port

Use pg_lsclusters to see every local cluster and its port. Compare that output with the host, port and database in your connection command. Explicitly select the intended port when more than one cluster is online, then run both verification queries again.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Package-version mismatch after an upgrade

Compare the running major in pg_lsclusters with the suffix in postgresql-<major>-postgis-3. If they differ, install the PostGIS package for the running major or complete the PostgreSQL migration so the application and extension use the intended major. Do not assume that a package installed for an older cluster is reusable by a newer major.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The package installs but the application still cannot use spatial types

Package installation and database enablement are separate. Connect to the exact application database, not the maintenance database, run CREATE EXTENSION postgis;, and check postgis_full_version(). If the application connects with a different database name, port or cluster than your administrative session, repeat the checks through that same connection target.

A repeatable installation checklist

  1. Record the VPS distribution, release codename and architecture.
  2. Choose the PostgreSQL major required by the application.
  3. Decide whether the distribution repository supplies that major or whether PGDG is needed.
  4. Configure PGDG with the documented helper or the exact manual source procedure when required.
  5. Install postgresql-<major>, postgresql-<major>-postgis-3, and the unversioned postgis tools package.
  6. Run pg_lsclusters and record the active cluster, status and port.
  7. Create a dedicated application database such as gisdb.
  8. Connect to that database and run CREATE EXTENSION postgis;.
  9. Add raster, topology or SFCGAL extensions only when the application needs them.
  10. Run SELECT postgis_full_version(); and the pg_available_extensions query.
  11. Store the major, cluster, port, database and enabled extensions in the deployment record.

What a successful result looks like

A complete self-managed setup has a PostgreSQL cluster online, a PostGIS package whose major matches that cluster, and a dedicated application database in which the extension has been created. The availability query returns PostGIS for the connected server, and postgis_full_version() reports its build from the application database. At that point the VPS is ready for spatial schemas and data loading; the optional modules remain separate choices rather than prerequisites.

Frequently Asked Questions

Can I install PostGIS without installing PostgreSQL?

No. PostGIS is a PostgreSQL extension. Install the PostgreSQL server and the PostGIS package matched to its major version; PostGIS is then enabled inside individual databases.

Should PostGIS be enabled in the default postgres database?

No. Create an application database, connect to it, and run CREATE EXTENSION postgis; there. The default postgres database is intended for maintenance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I know which PostgreSQL major needs the PostGIS package?

Run pg_lsclusters on a Debian-style VPS. Its output shows each cluster’s major, name, status and port; install postgresql-<major>-postgis-3 for the cluster your application uses.

Do managed PostgreSQL services require APT installation?

Usually not when the service already supplies PostGIS. Check the provider’s extension list, then enable it in the target database with the privileged role the service allows.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.