Install pldebugger for PostgreSQL on CentOS, RHEL 7, 8

The debugger may be used to debug PL/pgSQL functions in PostgreSQL, as well as EDB-SPL functions, stored procedures and packages in EDB Postgres Advanced Server. The pldebugger is available as an extension for your PostgreSQL database.

For this guide we have already set up PostgreSQL version 12 on a CentOS 7. These instructions can also be applied if you are running an earlier or later release of PostgreSQL in your environment.

 

Install Prerequisites

If you are running CentOS 7, you can install prerequisites with below command:

sudo yum -y install epel-release
sudo yum -y install centos-release-scl
sudo yum -y update
sudo yum -y install gcc gcc-c++ kernel-devel make git nano openssl openssl-devel krb5-libs krb5-devel

sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum -y install postgresql12-devel postgresql12-contrib
For CentOS 8, you can install prerequisites with below command:
sudo dnf -y install epel-release
sudo dnf config-manager --set-enabled PowerTools
sudo dnf -y update
sudo dnf -y install redhat-rpm-config gcc gcc-c++ kernel-devel make git nano openssl openssl-devel krb5-libs krb5-devel

sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm sudo dnf -y install yum-utils sudo yum-config-manager --enable pgdg12 sudo dnf -qy module disable postgresql sudo dnf -y install postgresql12-devel postgresql12-contrib

 

Clone pldebugger

Type below command to clone pldebugger from official repository:

cd /usr/local/src
sudo git clone https://git.postgresql.org/git/pldebugger.git

 

Install pldebugger

You must be root to perform below pldebugger installation steps:

su - root
PATH=$PATH:/usr/pgsql-12/bin
export PATH
cd /usr/local/src/pldebugger
export USE_PGXS=1
make

You will see the output similar to the following:

Type below to install pldebugger:

make install

Next, edit postgresql.conf file with any of your favorite text editor:

nano /var/lib/pgsql/12/data/postgresql.conf
Locate the following parameter, uncomment, add 'plugin_debugger' as its value:
shared_preload_libraries = 'plugin_debugger'

Save and close the editor when you are finished.

Now restart PostgreSQL to take changes into effect:

systemctl restart postgresql-12

 

Install pldbgapi extension

You need to switch to postgres user to connect to a PostgreSQL database, you would like to enable debugging:

su postgres
psql
Type below on postgres=# prompt to install the pldbgapi extension:
postgres=# CREATE EXTENSION pldbgapi;
Type below to exit from postgres=# prompt:
postgres=# \q

 

Wrapping up

You now have successfully installed pldebugger for your PostgreSQL database on a CentOS 7.

No comments:

Powered by Blogger.