Setting up PostgreSQL for installation


The following PostgreSQL versions are supported for Linux platforms: 

  • PostgreSQL 10, 11, 12, 13, and 14.

If PostgreSQL is already installed as a database engine with default settings, you need to execute the following:

  • Ensure that PostgreSQL was compiled with UTF8 support.
  • If you are installing the master on a CentOS x64 system, make sure that the symbolic link to the libpq.so library exists. If not, it must be created via the following command before installing the master:

    ln -s /usr/lib64/libpq.so.4 /usr/lib64/libpq.so

In addition, you need to execute the following before installing the master:

To configure PostgreSQL

  • Verify that the database is configured as follows:
    1. Configure the appropriate authentication with pg_hba.conf in your PGDATA directory:

      <?xml version="1.0" encoding="UTF-8"?>
      # TYPE DATABASE USER CIDR-ADDRESS METHOD
      # "local" is for UNIX domain socket connections only
      local all all ident sameuser
      # IPv4 local connections:
      host all all 127.0.0.1/32 trust
      #host all all 192.168.1.0 255.255.255.0 md5
      host all all 192.168.1.0 255.255.255.0 trust (this example allows connection from an IP included in the range from 192.168.1.1 to 192.168.1.254)
      # IPv6 local connections:
      host all all ::1/128 trust
    2. Enable TCP sockets by verifying or adding the following lines to postgresql.conf in your PGDATA directory:

      <?xml version="1.0" encoding="UTF-8"?>
      listen_addresses = '*' #this entry defines what IP addresses are listened on, it contains either a comma separated list of addresses, localhost which is the default or '*' for all.
      port = 5432
    3. Restart PostgreSQL.
    4. Verify that the file PG_VERSION is present in the path where the tablespaces were created.
  • Verify that parameters in the postgresql.conf file are set as follows:

    Parameter

    Description

    autovacuum = on

    All entries that are deleted in the database are also deleted from the files on the disk.

    standard_conforming_strings = off

    The backslash character is interpreted as the escape character (behavior similar to version 8 and earlier).

    escape_string_warning = off

    The backslash character does not generate any warnings. This option is not mandatory, but it is recommended to set it to off.

To connect the master to PostgreSQL

  1. Set the full log on the master by editing the mxtagent.ini file and setting the EnableTypes parameter to (All).
  2. The file is located in the master installation directory (by default /usr/local/ ) in the etc folder.
  3. Start the Client Management service, BMCClientManagementAgent by default.

    The first time the master connects to the previously created database, it creates all tables. This initialization phase can take several minutes.

  4. In the log directory of the master installation directory, open the mtxagent.log file and verify that there are no errors.

    Note:

    If the master cannot connect to the database, you should see a connection problem error entry in the log. If this is the case, take the following actions:

    1. Verify the connection parameter in the Vision64database.ini file on the master (parameters to check: DatabaseType, DatabaseName, Host, Port, User and Password).
    2. If all the parameters in the Vision64database seem to be correct, try to connect to PostgreSQL with the following command line:

      psql -U <USERNAME> -d DATABASENAME
      Example
      psql -U postgres -d bcmdb

To create a database on PostgreSQL

If you want to execute the default example installation on a SUSE Linux system, the database must use the default name bcmdb, and the default user name postgres with no password. To do so, proceed as follows:

  1. Copy the create_amp_tables.sh file from the support/database/postgres directory to the PostgreSQL server.
  2. Log in as the PostgreSQL user or as root, and type su postgres.
  3. Change to the directory where the database files should be created.
  4. Type sh /[script path]/ create_amp_tables.sh .

    This creates a directory called bcmdb with the required folder structure for the PostgreSQL tablespaces.

    To create the database with another name, you must first open the file used for the following procedure and modify the name from bcmdb to the new name.

To create tablespaces for PostgreSQL

By default, the BMC Client Management database tablespaces are created in the system account. It is however strongly recommended to create a specific account for BMC Client Management and create the tablespaces in this account. To do so, some further operations need to be carried out. The scripts to create the tablespaces are located in the support/database/postgres directory.

  1. Open the support/database/postgres/Create_TS.postgres.sql file in any text editor.
  2. Replace all occurrences of:
    • &1 with the path to the BMC Client Management database folders, for example, if the path previously defined was /var/lib/pgsql/data , &1 should be replaced with /var/lib/pgsql/data/ bcmdb.
    • &2 with the DatabaseBmcdbUser , that is, the user name that is used to connect to the BMC Client Management database. If a user other than postgres is used, this user name must be created manually.
    • &3 with the [Database Name] (only one occurrence).
  3. Save the file.
  4. Run this script with any PostgreSQL tool capable of running scripts, or use the psql -U postgres -W -f /[file path]/Create_TS.postgres.sql command line.
    The tablespaces are now created and you can continue with the master installation.

To set the password encryption to scram-sha-256

BMC Client Management 21.02 uses the recent Postgres library version (13.1) which supports new cryptography. It enables you to change the password encryption from default cryptography to scram-sha-256 or other. To do that, proceed as follows:

  1. Make the following changes in postgreSQL.conf.

    #------------------------------------------------------------------------------
    # CONNECTIONS AND AUTHENTICATION
    #------------------------------------------------------------------------------
    password_encryption = scram-sha-256
  2. Restart PostgreSQL.
  3. Change user password.
  4. Connect to PostgreSQL.

    psql -h PostgresServerName or IP -p 5432 -U postgres -d postgres
    postgres=# ALTER USER postgres WITH PASSWORD 'numara';
  5. Check if the password is encrypted.

    postgres=# select '*' from pg_shadow;
    postgres=# \q
  6. Make the following changes in pg_hba.conf.

    Change Method
    # TYPE DATABASE USER ADDRESS METHOD
    host all all 127.0.0.1/32 scram-sha-256
    host all all 10.5.159.0/24 trust
    host all all 10.64.0.0/16 scram-sha-256
    host all all 172.0.0.0/8 trust
  7. Restart PostgreSQL.

    psql -h PostgresServerName or IP -p 5432 -U postgres -d postgres
    Password for user postgres:
    postgres=# \q

    Linux 32-bit, Windows 32-bit, and macOS no longer compile Postgres and Oracle.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*