Installing PostgreSQL for Linux on Power Systems Servers

Use this task to install PostgreSQL for Linux on Power Systems Servers. The training server and stand-alone edge use a PostgreSQL database.

Procedure

  1. su to root by using the following command:
    sudo su
  2. Download the source for PostgreSQL:
    wget https://ftp.postgresql.org/pub/source/v9.5.13/postgresql-9.5.13.tar.gz
  3. Install PostgreSQL by using the following commands:
    tar -zxvf postgresql-9.5.13.tar.gz
    cd postgresql-9.5.13/
    yum -y install readline-devel
    ./configure --prefix=/usr/local/postgresql
    make
    make install
  4. Create user postgres and change owner for the postgres directory:
    useradd postgres
    chown -R postgres:postgres /usr/local/postgresql/
  5. Change to user postgres:
    su postgres
  6. Configure the system path for postgres:
    vi ~/.bashrc
    PGHOME=/usr/local/postgresql
    export PGHOME
    PGDATA=/usr/local/postgresql/data
    export PGDATA
    PATH=$PATH:$HOME/.local/bin:$HOME/bin:$PGHOME/bin
    export PATH
  7. Source the configuration:
    source ~/.bashrc
  8. Initialize the PostgreSQL database:
    initdb
  9. Configure the database. Open postgresql.conf in vi:
    vi /usr/local/postgresql/data/postgresql.conf
    Change:
    #listen_address='localhost' 
    #port = 5432 

    to:
    listen_address='*' 
    port = 5432

    Open the pg_hba.conf file in vi:
    vi /usr/local/postgresql/data/pg_hba.conf
    Add the following line to the file:
    host all all 0.0.0.0/0 trust
  10. Restart postgresql:
    pg_ctl -D /usr/local/postgresql/data -l logfile restart
  11. Change the password for user postgres in the PostgreSQL database:
    psql
    ALTER USER postgres WITH PASSWORD 'password';
    \q
    If the postgresql service is not started, run the following commands:
    su postgres
    vi ~/.bashrc
    Add /usr/local/pgsql/bin/ to the file:
    export PATH=/usr/local/cuda-8.0/bin:$PATH:/usr/local/pgsql/bin/
    Run the following command:
    source ~/.bashrc
  12. Create the database schema in PostgreSQL. Run the following command on the psql console:
    create database edge with owner postgres encoding='UTF-8' lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
    In the database, create the following tables:
    CREATE TABLE vi_tenant_inspectionresult(id text, info jsonb); 
    CREATE TABLE vi_tenant_notification(id text, info jsonb); 
    CREATE TABLE vi_tenant_defectsummary(id text, info jsonb); 
    CREATE TABLE vi_tenant_uploaddataset(id text, info jsonb); 
    CREATE TABLE vi_tenant_syncprocess(id text, info jsonb); 
    CREATE TABLE vi_tenant_model(id text, info jsonb); 
    CREATE TABLE vi_tenant_datagroup(id text, info jsonb);

    where tenant is the tenant for the operation user in the Maximo® PQI SaaS Visual Insights center. You can get the tenant value from the user profile in the user interface for the center application.