Installing pgAdmin 4

You can use a lot of administration tools to manage PostgreSQL. pgAdmin 4 is one of the most popular and feature-rich Open Source administration and development platform for PostgreSQL. It is recommended that you install and use pgAdmin 4.

About this task

This topic describes how to install pgAdmin 4 via container image on xLinux as an example. If you want to install pgAdmin 4 via native installation package, you can follow related guide in pgAdmin 4 web site.

Procedure

  1. Create the required user and group through the following commands:
    Create the required group pgadmin:
    groupadd pgadmin -g 5050
    Create the required user pgadmin:
    useradd pgadmin -g 5050 -p your password -u 5050 -d /home/pgadmin
  2. Create one directory in your host machine to save all pgAdmin 4 related data through the following commands.
    mkdir -p /var/lib/pgadmin/data 
    mkdir -p /var/lib/pgadmin/servers.json 
    chown -R pgadmin:pgadmin /var/lib/pgadmin
  3. Generate a self-assigned certificate with the following steps if you do not have your own certificate.
    Note: You can skip the step if you re-use the self-assigned certificate of Z ChatOps server.
    1. Go to the directory where you extract the IBM Z® ChatOps container archive.
    2. Use the following command to generate a self-assigned certificate. Replace the host name and IP address with the values of your Z ChatOps server.
      ./tools/generateCert.sh host_name IP_address
      A folder named with your hostname will be created. You can find the generated certificate bnzsvr-server.crt and the key file bnzsvr-server.key in that folder.
  4. Create and run new pgAdmin 4 container from the downloaded image through the following command.
    docker run -d --name yourcontainerName -p your port in host:443 -v your created directory:/var/lib/pgadmin -v your SSL certificate:/certs/server.cert -v your SSL key:/certs/server.key -v your created directory:/pgadmin4/servers.json -e 'PGADMIN_DEFAULT_EMAIL=your email' -e 'PGADMIN_DEFAULT_PASSWORD=your password' -e 'PGADMIN_ENABLE_TLS=True' dpage/pgadmin4
    For example,
    docker run -d --name chatops-pgadmin -p 5443:443 -v /var/lib/pgadmin/data:/var/lib/pgadmin -v $ZCHATOPS_HOME/config/ssl/bnzsvr-server.crt:/certs/server.cert -v $ZCHATOPS_HOME/config/ssl/bnzsvr-server.key:/certs/server.key -v /var/lib/pgadmin/servers.json:/pgadmin4/servers.json -e 'PGADMIN_DEFAULT_EMAIL=your email' -e 'PGADMIN_DEFAULT_PASSWORD=your password' -e 'PGADMIN_ENABLE_TLS=True' dpage/pgadmin4
  5. Log in your pgAdmin 4 User Interface to verify if pgAdmin 4 is installed successfully through https://your host name:your port number.
    PgAdmin 4 User Interface login page

What to do next

After you install pgAdmin 4, install pgAgent. For more information, see Installing pgAgent.