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

First identify the exact operating system release and processor architecture: PostgreSQL package names, available major versions, and supported installation routes vary by platform. On Ubuntu, the simplest route is the Ubuntu package repository; use PostgreSQL’s Apt Repository if you need a different supported version. On a CentOS-family RPM system, confirm whether it is CentOS Stream and which release before using commands documented for RHEL, Rocky Linux, AlmaLinux, or Fedora. On Windows, the PostgreSQL download page links to EDB’s installer for a standard installation, or a binary ZIP for advanced application bundling.

Before you install: identify your OS and choose a stable release

Record the OS edition and release, architecture, and the PostgreSQL major version your application requires. A package named postgresql does not necessarily mean the same major version on every operating system: distribution repositories select packages for their releases, while the PostgreSQL project’s repositories offer their own supported version choices.

  • For Ubuntu, check the Ubuntu release and architecture before choosing the distribution package or the PostgreSQL Apt Repository.
  • For CentOS, establish whether you mean CentOS Stream and confirm its major release. The PostgreSQL project’s current Red Hat-family download page names RHEL, Rocky Linux, AlmaLinux, and Fedora—not CentOS.
  • For Windows, distinguish the EDB interactive or silent installer from the advanced ZIP of binaries, and check the tested Windows matrix for the PostgreSQL version you want.
  • For production, choose a supported stable release. PostgreSQL also publishes beta, release-candidate, and development builds for testing and evaluation; its downloads page says these are for testing rather than production systems.

Use the official PostgreSQL Downloads hub to select your operating-system family and follow its current release-specific instructions. Compatibility lists change, so verify the live page rather than treating a version matrix as permanent.

Install PostgreSQL on Ubuntu

Option 1: install the Ubuntu distribution package

Ubuntu includes PostgreSQL in its repositories. This is usually the most straightforward choice if the version packaged for your Ubuntu release meets your needs. In a shell with administrator privileges, run:

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

The package version is the one Ubuntu provides for that OS release. The package name does not let you choose a PostgreSQL major version explicitly, so check the installed version afterward:

psql --version

The Ubuntu package instructions are on the PostgreSQL Linux downloads page for Ubuntu. If you need a particular major version, compare the Ubuntu package with the version-specific packages in the PostgreSQL Apt Repository before deciding.

Option 2: use the PostgreSQL Apt Repository

Use the project-maintained Apt Repository when Ubuntu’s package is not the major version you need and your Ubuntu release and architecture are supported. The repository page provides an automated setup script. Its current setup sequence is:

sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh

Follow any prompts from the setup script, then install the version-specific package you need. The PostgreSQL repository page gives PostgreSQL 18 as an example:

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

Replace 18 with the supported major version you intend to install. The project identifies postgresql-18 as the core server package and postgresql-client-18 as the client libraries and binaries for that version. Check the live Ubuntu repository page before setup: its currently listed releases are Ubuntu 26.10 “stonking,” 26.04 “resolute,” 24.04 “noble,” and 22.04 “jammy.” Architecture availability varies: amd64 is listed, while arm64 and ppc64el are listed for LTS releases only. These lists can change.

Choose between the two Ubuntu routes

Route Choose it when Version selection
Ubuntu repository You want the distribution-selected PostgreSQL package and it meets your requirements. Ubuntu selects the package version for its OS release.
PostgreSQL Apt Repository You need a different supported major version offered by the project repository. Install an explicit package such as postgresql-18, after checking the current supported release and architecture list.

Install PostgreSQL on CentOS and related RPM systems

Confirm the exact distribution before copying commands

Do not assume that a command documented for RHEL or Fedora applies to every CentOS release. The PostgreSQL project’s current Red Hat-family page explicitly covers RHEL, Rocky Linux, AlmaLinux, and Fedora; it does not list CentOS by name. If you use CentOS, confirm whether it is CentOS Stream, identify its major release and architecture, and verify the matching vendor and PostgreSQL package instructions before installing.

For the distribution packages covered by the official page, the available PostgreSQL versions vary by release. The page currently lists RHEL, Rocky Linux, and AlmaLinux 10 with PostgreSQL 16; release 9 with 16, 15, and 13 through modules; release 8 with 15, 13, 12, 10, and 9.6 through modules; and Fedora 44 and 43 with PostgreSQL 18. Check the current Red Hat-family download page for the exact package and supported release. Do not infer the major version from a generic package name alone.

Install and initialize the distribution package

For the RHEL and Fedora systems covered by the project’s instructions, install the server package with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo dnf install postgresql-server

On RHEL, Rocky Linux, and AlmaLinux 10, 9, and 8, or Fedora 43 and later, the documented next steps initialize the database and enable and start its service:

sudo postgresql-setup --initdb
sudo systemctl enable postgresql.service
sudo systemctl start postgresql.service

Initialization is a required part of this workflow: under Red Hat-family distribution policy, PostgreSQL is not automatically initialized or enabled to start after package installation. Enabling the service configures it to start on boot; starting it launches it now. For a different release or for CentOS Stream, first verify the appropriate setup utility and service instructions rather than assuming this exact sequence applies. The PostgreSQL page documents these commands and release scope at its Red Hat-family instructions.

When to use the PostgreSQL Yum Repository

If the distribution package does not provide the major version you need, the PostgreSQL Yum Repository setup flow lets you select a supported distribution, version, architecture, and PostgreSQL version, then provides the relevant setup script. The project lists RHEL, Rocky Linux, AlmaLinux, and Fedora for this route; confirm the current list before applying it to a CentOS system. PostgreSQL notes that Fedora has a shorter support cycle and is not recommended for server deployments.

Install PostgreSQL on Windows

Standard installation with the EDB installer

Start at the PostgreSQL Windows installers page, which links to an installer hosted by EDB. The installer is EDB-hosted, not hosted on PostgreSQL community servers. It includes the PostgreSQL server, pgAdmin, and StackBuilder, and supports both graphical and silent installation modes. Follow the installer prompts for the components and settings you need; the PostgreSQL download page is the place to verify current Windows downloads and version compatibility.

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

Check the Windows version matrix

The Windows page’s current EDB-tested 64-bit matrix lists these combinations:

PostgreSQL major version Windows Server versions listed as tested
18 2025 and 2022
17 and 16 2022 and 2019
15, 14, and 13 2019 and 2016

The page says comparable Windows versions, including desktop releases, may generally work; that is not the same as a listed tested combination. Check the live Windows installer page for the current matrix before choosing a major version or deploying to a particular edition.

Use the ZIP only when you need application-bundled binaries

The Windows download page also offers a ZIP archive of binaries for advanced users who want to include PostgreSQL in another application’s installer. This is distinct from the standard installer route; choose it when you specifically need binaries to bundle, rather than expecting the usual interactive installation workflow.

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

Verify the installation and investigate common failures

Confirm the client version and service state

After installation, check that the PostgreSQL command-line client is available:

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

This reports the client version, not proof by itself that a server is running or accepting connections. On the RPM workflow documented above, check the service state with:

systemctl status postgresql.service

If you installed a package but have not initialized the RPM database cluster, complete the release-appropriate initialization step before expecting the service to work. For Ubuntu and Windows, follow the respective package or installer’s instructions for connecting to the server; the commands above do not create application roles or configure remote access.

Common installation problems

  • The installed major version is not the one your application needs: the Ubuntu distribution package is selected for the OS release, and RPM distribution packages vary by release. Check the package matrix; use the PostgreSQL Apt or Yum Repository when it supports the required version and platform.
  • The repository setup does not support your Ubuntu release or architecture: compare the exact OS codename and architecture with the live Apt Repository list. Do not substitute another release’s repository configuration without confirming support.
  • dnf cannot find the expected server package: confirm the distribution, release, enabled package sources, and vendor instructions. The PostgreSQL project’s Red Hat-family instructions do not name CentOS, so verify CentOS Stream-specific guidance rather than treating it as an explicitly covered target.
  • The RPM package is installed but PostgreSQL does not start: on the releases covered by the official sequence, initialize with postgresql-setup --initdb, then enable and start postgresql.service. For other releases, confirm the correct utility and service name.
  • A Windows version is absent from the tested matrix: check the current Windows downloads page. The page says comparable versions may generally work, but it does not make every Windows edition a tested combination.
  • A command is unavailable after installation: verify that the package or installer included the client binaries and that the command is on your shell’s path. The PGDG Apt page identifies a separate versioned client package, such as postgresql-client-18.

Choose a route by version, support, and deployment needs

For an ordinary Ubuntu setup, start with Ubuntu’s package and move to the PostgreSQL Apt Repository only when its version or package choice does not meet your needs. For the RPM family, use the documented package path only for a confirmed supported distribution and release, and include initialization and service startup. For Windows, use the EDB-hosted installer for a standard server setup; reserve the ZIP for advanced application bundling. In every case, verify current supported releases and architecture before installing, particularly when the requirement is a specific PostgreSQL major version.

Or skip the browser setup

If you need website screenshots while building or documenting an application, ScreenshotNeo is a screenshot API and MCP server for developers. One GET request can return a PNG, JPEG, WebP, or PDF. Its clean-shot flow accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; individual steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.

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

Example cURL request (replace the URL with the page to capture):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for API details. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Does installing PostgreSQL also install pgAdmin?

The EDB-hosted Windows installer includes pgAdmin; the Ubuntu and RPM package commands in this guide install server packages, not a Windows-style bundled installer.

Can I use a PostgreSQL beta or release candidate for production?

The PostgreSQL downloads page describes beta, release-candidate, and development builds as builds for testing and evaluation, not production systems.

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.

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.