Offline PostgreSQL Installation on RHEL 9: Solving the No Internet Challenge

PostgreSQL is one of the most loved databases, especially by developers, for its simplicity, easy configurations, and massive community support. It’s an open-source powerhouse known for handling everything from small projects to large-scale applications. While major cloud providers, like AWS, Google, and Microsoft offer robust solutions for hosting databases on the cloud, not all businesses can or want to go this routeMany companies, choose to store their databases in secure, closed environments—machines without internet access or outside the cloud. This is often done to maintain tight control over sensitive data and to meet strict security requirements. However installing PostgreSQL in a restricted, offline environment can be a real challenge, as it limits access to typical installation tools. Recently, I worked on a client project with a similar setup—a secure, offline environment without internet access—where we needed to install and configure PostgreSQL from scratch. If you’re facing the challenge of setting up PostgreSQL in a closed environment, this blog will guide you through the process step-by-step.

Installing PostgreSQL Using RPM Packages

We will be using PostgreSQL RPMs on RHEL to install PostgreSQL without internet access. There are two methods to achieve this. The first option is to visit this link https://download.postgresql.org/pub/repos/yum/15/redhat/rhel-9.4-x86_64/and download each RPM package individually. However, this approach can lead to missing dependencies, You might forget which packages are necessary or overlook certain dependencies. If a required RPM is missing from the provided URL, you’ll have to search the internet to find the correct RPM.The second option is to set up an alternative machine with internet access and use a few yum commands to download the necessary RPMs along with all their dependencies. Once you have downloaded the RPMs, you can upload them to the target host. This method ensures that all required RPMs are included, saving you the hassle of searching for packages online and significantly reducing the time spent on the installation process.

On the host with internet

Run yum deplist command to find out all the required packages to install PostgreSQL (Make sure the PGDG repository is already configured on your host)Read more here: https://www.postgresql.org/download/
sudo yum deplist postgresql17-server
Once you get the list then you can run this command to download the packages 
sudo yum install --downloadonly --downloaddir=postgres-rpms/ postgresql17-server
Where postgres-rpms is the local directory name on the filesystem where all the required RPMs will be downloaded Once this is done and you have the required list of RPMs go ahead and upload them to the server without internet access and install the RPMs with 
sudo rpm -ivsh *.rpm
Or run 
sudo yum localinstall *.rpm
This made the PostgreSQL installation quite straightforward, as it only required an additional 3 or 4 packages. However, in our upcoming blogs, we will explore how to install PostGIS, which has a significantly larger number of dependencies, and discuss effective methods for installing PostGIS without internet access.

Frequently Asked Questions (FAQs)

Q.What is the recommended workflow for deploying PostgreSQL in air-gapped RHEL environments?

The most effective strategy involves using a temporary internet-connected staging server running the same OS version as the target. You use this staging machine to resolve and download the specific PostgreSQL RPMs and all dependencies, then securely transfer the complete package set to the offline environment.

Instead of manually guessing requirements, run sudo yum install –downloadonly –downloaddir=[directory] postgresql17-server on your staging machine. This command utilizes the package manager to identify and download the entire dependency tree, ensuring no required libraries are missing during the final install.

Downloading packages individually often leads to “dependency hell” where the installation fails due to missing or mismatched shared libraries. The manual approach lacks the automatic resolution logic of the package manager, increasing deployment time and the likelihood of configuration errors.

You can execute sudo yum deplist postgresql17-server on the connected staging host. This command outputs a comprehensive list of every dependency and provider package required by the PostgreSQL server, allowing for verification of the software supply chain.

Once the RPMs are transferred to the target host, the best practice is to run sudo yum localinstall *.rpm. This method is preferred over standard RPM commands because it automatically handles the installation order and verifies the integrity of the local package set.

Related Resources

Case Studies

Webinars

Latest Blogs

January 20, 2026

PostgreSQL on Kubernetes vs VMs: A Technical Decision Guide

If your organization is standardizing on Kubernetes, this question shows up fast: “Should PostgreSQL run on Kubernetes too?” The worst…
December 23, 2025

PostgreSQL Column Limits

If you’ve ever had a deployment fail with “tables can have at most 1600 columns”, you already know this isn’t…
December 17, 2025

The Road to Deploy a Production-Grade, Highly Available System with Open-Source Tools

Everyone wants high availability, and that’s completely understandable. When an app goes down, users get frustrated, business stops, and pressure…

Leave A Comment