Skip to content

PostgreSQL Installation

The official installation info is available at PostgreSQL: Documentation: 18: 1.1. Installation.

All the information below is a guidelines authored by the SmartPTT team.

Components§

You need the following PostgreSQL components:

  • PostgreSQL: database engine.
  • pgAdmin: GUI-based configuration tool.
  • psql: one of several command line tools required for the remote (IP) PostgreSQL access.
  • is_pgready: one of several command line tools, required for the remote PostgreSQL accessibility tests.

Prerequisites§

UI Mode§

To install necessary components in UI mode, follow the official or a third-party instructions.

Basically, all the required components are included in the GUI-based installation packages.

Quiet Mode§

Database Engine Only§

To download and install the engine only in Windows, perform the following actions:

  1. Prepare an installation options file.

    option-file.txt
    # Specifies quiet mode
    mode=unattended
    unattendedmodeui=none
    
    # Installs the database engine only
    enable-components=server
    
    # CRITICAL: set up initial user credentials
    superaccount=postgres
    superpassword=YourSecurePassword123
    
    # Disables shortcuts creation
    create_shortcuts=0
    
    # Installs VC++ is required
    install_runtimes=1
    
    # Optional: set up custom port number
    serverport=5432
    
    # Optional: set up custom paths
    prefix=C:\Program Files\PostgreSQL\18       # path to the engine
    datadir=C:\Program Files\PostgreSQL\18\data # path to databases
    
    # Optional: Credentials of custom Windows service user
    serviceaccount=username
    servicepassword=password
    
  2. Run the installation script for the downloaded installation package and the prepared installation options file.

    Windows
    PowerShell
    # Set up the downloaded PostgreSQL version
    $Version = 18
    
    # Set up the download directory
    $DownloadFolder = "C:\folder"
    
    # Set up the path to option file
    $OptionFile = "C:\folder\option-file.txt"
    
    # Download the PostgreSQL installation package
    winget download -e --id PostgreSQL.PostgreSQL.$Version -d $DownloadFolder
    
    # Get the installation package name
    cd $DownloadFolder
    $FileName = (Get-ChildItem *.exe).Name
    
    # Start the engine-only installation
    $FileName --mode unattended --optionfile $OptionFile
    

Danger

If you download and install the PosgreSQL with winget install, superuser password will NOT be specified. Anyone who accesses the PostgreSQL first may gain control over it.

To prevent that, do not use the winget install command for the database engine unless you do that for demo purposes. Instead, use winget download to download the installation package and then install the engine in UI or quiet mode.

pgAdmin§

To download and install only pgAdmin (required for the DBMS configuration), execute the following command:

winget install -e --id PostgreSQL.pgAdmin

Command Line Tools§

The tools provide the ability for SmartPTT Express server to interface with PostgreSQL. They must be installed on the SmartPTT Express server host.

To download and install them tools, perform the following commands:

PowerShell
# Specify the PostgreSQL version
$Version = 18

# Set up the download folder for the installation package
$DownloadFolder = "C:\Folder"

# Download the installation package
winget download -e --id PostgreSQL.PostgreSQL.$Version  -d $DownloadFolder

# Get the downloaded package file name
cd $DownloadFolder
$FileName = (Get-ChildItem *.exe).Name

# Install the tools in the quiet mode
$FileName --mode unattended --unattendedmodeui none --enable-components commandlinetools

Postrequisites§