Install Postgresql and Pgpool

PostgreSQL packages for Debian and Ubuntu. PostgreSQL is an open-source, object-relational database system with a strong reputation for feature robustness, extensibility, and compliance with technical standards.

Currently, PostgreSQL support:

  • Debian 9 (stretch), 10 (buster), 11 (bullseye), 12 (bookworm), and unstable (sid)
  • Ubuntu 18.04 (bionic), 20.04 (focal), 21.10 (impish, amd64 only), 22.04 (jammy)
  • Architectures: amd64 (64-bit x86), i386 (32-bit x86, being phased out), arm64 (64-bit ARM), ppc64el (little-endian 64-bit POWER)
  • PostgreSQL 10, 11, 12, 13, 14, 15 devel
  • Server extensions such as Slony-I, various PL languages, and datatypes
  • Applications like omnidb, pgbouncer, and pgpool-II

Import the repository key from https://www.postgresql.org/media/keys/ACCC4CF8.asc

# https://wiki.postgresql.org/wiki/Apt
sudo apt-get install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
Create /etc/apt/sources.list.d/pgdg.list.

The distributions are called codename-pgdg.
You may determine the codename of your distribution by running lsb_release -c.
In the example, replace buster with the actual distribution you are using File contents:

deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main

For a script version of the above file creation, presuming you are using a supported release:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Finally, update the package lists, and start installing packages:

# Replace 14 with postgresql-10, 11, 12, 13, 14 to install desired
sudo apt update
sudo apt install postgresql-14 postgresql-contrib libpq-dev
# OR WITH PGPOOL
sudo apt install postgresql-14-pgpool2 postgresql-contrib libpq-dev
# To install PGPOOL2
sudo apt install pgpool2

Pgpool-II only accepts connections from the local host enbaled using port in my case 5433. If we wish to receive connenctions from other hosts, set listen_addresses to ‘*’.

vim /etc/pgpool2/pgpool.conf
# change the next lines
listen_addresses = '*'
port = 5433

DONE! ))

Comments

Popular posts from this blog

Installing the Certbot Let’s Encrypt Client for NGINX on Amazon Linux 2

Deploy Nuxt.js app using Apache 2

psql: error: connection to server at "localhost" (127.0.0.1), port 5433 failed: ERROR: failed to authenticate with backend using SCRAM DETAIL: valid password not found