Installing the psycopg2 Python package for PostgreSQL-backed Hue
If you are installing Runtime 7 and using PostgreSQL as a backend database for Hue, then you must install the 2.9.5 version of the psycopg2 package on all Hue hosts. The psycopg2 package is automatically installed as a dependency of Cloudera Manager Agent, but the version installed is often lower than 2.9.3.
Cloudera recommends that you install the 2.9.5 version of the psycopg2
package on RHEL8 and CentOS 8.
Before you begin, you must disable the
postgresql10
section from the
cloudera-manager.repo
file as follows:- SSH in to the Cloudera Manager host as an Administrator.
- Change to the directory where you had downloaded the
cloudera-manager.repo
file. On RHEL, the file is present under the /etc/yum.repo.d directory. - Open the file for editing and update the value of the
enabled
property to0
as follows:[postgresql10] name=Postgresql 10 baseurl=https://archive.cloudera.com/postgresql10/redhat8/ gpgkey=https://archive.cloudera.com/postgresql10/redhat8/RPM-GPG-KEY-PGDG-10 enabled=0 gpgcheck=1 module_hotfixes=true
- Save the file and exit.
The following steps apply to CentOS 7, RHEL 7, and OEL 7:
- SSH into the Hue server host as a root user.
- Install the
psycopg2-binary
package as follows:pip3.8 install psycopg2-binary
- Repeat these steps on all the Hue server hosts.
If you get the "Error: pg_config executable not found" error
while installing the
psycopg2-binary
package, then run the following
commands to install the postgresql
, postgresql-devel
,
python-devel
packages:yum install postgresql postgresql-devel python-devel
Repeat this on all the Hue server hosts.
The following steps apply to RHEL 8.6 and CentOS 8.4:
- SSH into the Hue host as a root user.
- Install the
psycopg2
package dependencies for RHEL 8/CentOS 8 by running the following commands:dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install -y xmlsec1 xmlsec1-openssl
- Install the PostgreSQL database server by running the following
command:
dnf install -y postgresql-server
- Install the
postgresql-devel
package by running the following command:dnf install -y postgresql-devel
- Install the
psycopg2
package by running the following command:pip3.8 install psycopg2-binary==2.9.5
- SSH into the Hue host as a root user.
- Install the
psycopg2
package dependencies for SLES 12 and SLES 15 by running the following commands:zypper install xmlsec1 zypper install xmlsec1-devel Zypper install xmlsec1-openssl-devel
- Install the
postgresql-devel
package corresponding to your database version by running the following command:zypper -n postgresql[***DB-VERSION***]-devel
- Add the location of the installed
postgresql-devel
package to thePATH
environment variable by running the following command:export PATH=$PATH:/usr/local/bin
- Install the
psycopg2-binary
package by running the following command:pip3.8 install psycopg2-binary
- SSH into the Hue host as a root user.
- Install the
psycopg2
package dependencies for Ubuntu by running the following commands:apt-get install -y xmlsec1 apt-get install libxmlsec1-openssl apt-get install libpq-dev python3-pip -y
- Install the
python3-dev
andlibpq-dev
packages by running the following command:apt install python3-dev libpq-dev
- Add the location of the installed
postgresql-devel
package to thePATH
environment variable by running the following command:export PATH=$PATH:/usr/local/bin
- Install the
psycopg2
package by running the following command:pip3.8 install psycopg2==2.9.3 --ignore-installed