DEV Community

Cover image for Apache AGE Complete Installation Guide - Part 2 ( PostgreSQL )
David George
David George

Posted on

Apache AGE Complete Installation Guide - Part 2 ( PostgreSQL )

If you are a Windows user, don't miss Part 1 of this Guide ( WSL tool ) as we will build this blog considering you are using a Linux Terminal.

we start working through this blog from here,

Linux terminal

3. Installing PostgreSQL
As we mention before AGE is a PostgreSQL extension so we must first have PostgreSQL installed before installing AGE itself.

Important Notes :

  • from age GitHub repo "For now AGE supports Postgres 11, 12 & 13. Supporting the latest versions is on AGE roadmap.", so we can only use it on top of one of those versions ( which means currently not officially compatible with 14, 15, 16 beta) versions on this blog date.

  • Mainly the Master branch of the AGE GitHub repository supports PG11 ( PostgreSQL Major version 11 )

  • If you want to use PG12 you have to switch to the "AGE_PG12.1.0_ALPHA" branch of the age repo ( the master branch is incompatible with PG11 )

  • for this tutorial, we will use PG11 ( Major 11, Minor 20, 11.20 Latest minor for this version ) and the source of the master branch in the AGE repo.

let's start,
first of all, we cannot do it like,
sudo apt install postgresql

installing latest PG

, as this will get the latest version of PostgreSQL according to the current distro information.
in my case, it gets the PG15, which we cannot use AGE on yet.

we need to download a specific version ( for our case here PG11 ), so we specify the version to it as,
sudo apt install postgresql-11

for me, this doesn't work from the first try, for a time I was facing the "unable to locate package postgresql-11" error on trying it, and after reviewing the PG documentation I come up with a solution to this error.

to resolve this we do the following commands in order,

  • sudo apt install curl ca-certificates gnupg
  • url https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
  • sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
  • sudo apt update

After that, we can continue our installation and specify the desired version as we mentioned before and now it works fine with no errors ,

Specify the version on installing PG

but for our case, we need the PG11 one so do it as ,

sudo apt install postgresql-11 ,

After installation is complete we can check for it using the following command,
pg_config

PG_CONFIG

and to make sure that it's the needed version we check the VERSION ,

PG_CONFIG version

then to test it we can use psql ( PostgreSQL interactive terminal ) by,
sudo -u postgres psql

psql

what's psql ?

  • psql is a terminal-based front-end to PostgreSQL.
  • It enables you to type in queries interactively, issue them to PostgreSQL, and see the query results. Alternatively, the input can be from a file or command line arguments. In addition, psql provides several meta-commands and various shell-like features to facilitate writing scripts and automating a wide variety of tasks.

Okay, Now we have done installing the PostgreSQL through the Linux terminal and with the specified version we need, and we are ready for our last step from this tutorial, which is installing AGE and trying it.

Top comments (0)