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:
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 trustEnable 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- Restart PostgreSQL.
- 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
- Set the full log on the master by editing the mxtagent.ini file and setting the EnableTypes parameter to (All).
- The file is located in the master installation directory (by default /usr/local/ ) in the etc folder.
Start the Client Management service, BMCClientManagementAgent by default.
In the log directory of the master installation directory, open the mtxagent.log file and verify that there are no errors.
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:
- Copy the create_amp_tables.sh file from the support/database/postgres directory to the PostgreSQL server.
- Log in as the PostgreSQL user or as root, and type su postgres.
- Change to the directory where the database files should be created.
Type sh /[script path]/ create_amp_tables.sh .
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.
- Open the support/database/postgres/Create_TS.postgres.sql file in any text editor.
- 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).
- Save the file.
- 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:
Make the following changes in postgreSQL.conf.
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
password_encryption = scram-sha-256- Restart PostgreSQL.
- Change user password.
Connect to PostgreSQL.
psql -h PostgresServerName or IP -p 5432 -U postgres -d postgres
postgres=# ALTER USER postgres WITH PASSWORD 'numara';Check if the password is encrypted.
postgres=# select '*' from pg_shadow;
postgres=# \qMake 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 trustRestart PostgreSQL.
psql -h PostgresServerName or IP -p 5432 -U postgres -d postgres
Password for user postgres:
postgres=# \q