Installing PostgreSQL with native installation package

You can install PostgreSQL via native installation package. The location PostgreSQL installation package varies in your operating system architecture. You must choose the right package repository according to your environment.

About this task

  • If you want to install PostgreSQL on xLinux, you can directly get the installation package and follow the detailed guide to install PostgreSQL at PostgreSQL download website.
  • If you want to install PostgreSQL on zLinux, you can get the installation package from your zLinux system installation disk or corresponding package repository.

The following installing procedure takes Red Hat® on xLinux as an example.

Procedure

  1. Open the PostgreSQL Yum Repository, select version, platform and architecture according to your environment.
    Figure 1. Example steps to install the PostgreSQL service and start the service
    Example steps to install the PostgreSQL service and start the service
  2. Copy the steps to install the PostgreSQL service and start the service. For example,
    # Install the repository RPM:
    sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
    # Disable the built-in PostgreSQL module:
    sudo dnf -qy module disable postgresql
    # Install PostgreSQL:
    sudo dnf install -y postgresql16-server
    # Optionally initialize the database and enable automatic start:
    sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
    sudo systemctl enable postgresql-16
    sudo systemctl start postgresql-16