POSTGRESQL and APACHE AGE installation from source (Linux, Windows and mac)

muhammadtahanaveed

Muhammad Taha Naveed

Posted on February 10, 2023

POSTGRESQL and APACHE AGE installation from source (Linux, Windows and mac)

Apache AGE is an extension for PostgreSQL that enables users to leverage a graph database on top of the existing relational databases. AGE is an acronym for A Graph Extension and is inspired by Bitnine's AgensGraph, a multi-model database fork of PostgreSQL. The basic principle of the project is to create a single storage that handles both the relational and graph data model so that the users can use the standard ANSI SQL along with openCypher, one of the most popular graph query languages today.

This post will be covering installation of PostgreSQL from source and then installing AGE on top of that.


For Linux Users:

I will be installing PostgreSQL version 11.17 under ~/Desktop/pgsql_11.17/pgsql directory.

Pre-requisites:

sudo apt install gcc build-essential libreadline-dev zlib1g-dev flex bison
Enter fullscreen mode Exit fullscreen mode

PostgreSQL installation:

  • Download source code from here or goto terminal and type
cd ~/Desktop && wget https://ftp.postgresql.org/pub/source/v11.17/postgresql-11.17.tar.gz
Enter fullscreen mode Exit fullscreen mode
  • Now unzip the file using the command below.
tar -xf postgresql-11.17.tar.gz && rm postgresql-11.17.tar.gz
Enter fullscreen mode Exit fullscreen mode
  • Change directory into postgresql-11.17 and configure. This step of the installation procedure is to configure the source tree for your system and choose the options you would like. You can see other configuration options here.
cd postgresql-11.17 && ./configure --enable-debug --enable-cassert --prefix=$(pwd)/pgsql CFLAGS="-ggdb -Og -fno-omit-frame-pointer"
Enter fullscreen mode Exit fullscreen mode
  • Type the following command to start the build and installation process.
make install
Enter fullscreen mode Exit fullscreen mode
  • Adding pgsql/bin to path so that we can access commands from everywhere.
echo "export PATH="~/Desktop/postgresql-11.17/pgsql/bin:$PATH"" > ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

PostgreSQL Initialization

  • Now we have to make a database cluster and own this directory under the current user to start the server.
mkdir pgsql/data && chown $USER pgsql/data
Enter fullscreen mode Exit fullscreen mode
  • Now initialize the database cluster.
initdb pgsql/data
Enter fullscreen mode Exit fullscreen mode
  • Finally, we are ready to go. Start the server by typing the following command
pg_ctl -D pgsql/data -l logfile start
Enter fullscreen mode Exit fullscreen mode
  • Now to stop the server, type
pg_ctl -D pgsql/data -l logfile stop
Enter fullscreen mode Exit fullscreen mode

AGE Installation:

Now we are ready to install AGE.

  • Download the source code from here or clone the repo from GitHub by typing
cd ~/Desktop && git clone https://github.com/apache/age.git
Enter fullscreen mode Exit fullscreen mode
  • Now change directory to age and start installation. PG_CONFIG option needs the path to your pg_config command. Since we have already added pgsql/bin in path, so we don’t need to explicitly provide that.
cd age && make install
Enter fullscreen mode Exit fullscreen mode
  • Now check the installation by typing. All tests should pass.
make installcheck
Enter fullscreen mode Exit fullscreen mode

TADAAA…. We are ready to use AGE 😎.

Post installation:

  • Change the directory to postgresql-11.17 by typing
cd ~/Desktop/postgresql-11.17/
Enter fullscreen mode Exit fullscreen mode
  • Now we will start the server, create a new database and create extension age.
pg_ctl -D pgsql/data -l logfile start
createdb test
psql test

test=# CREATE EXTENSION age;
CREATE EXTENSION
Enter fullscreen mode Exit fullscreen mode

Per Session Instructions:

test=# LOAD 'age';
LOAD
test=# SET search_path = ag_catalog, "$user", public;
SET
test=# 
Enter fullscreen mode Exit fullscreen mode

We are done with installation and setup phase. For more information about AGE, refer to the official documentation.


For Windows Users

If you are a windows user, you can follow the steps described in the video below.


For Mac Users

If you are a mac user, you can follow the steps described in the video below.


Follow Apache AGE on following platforms:

GitHub logo apache / age

Graph database optimized for fast analysis and real-time data processing. It is provided as an extension to PostgreSQL.



is a leading multi-model graph database

Graph Processing & Analytics for Relational Databases



         


  What is Apache AGE?

Apache AGE is an extension for PostgreSQL that enables users to leverage a graph database on top of the existing relational databases. AGE is an acronym for A Graph Extension and is inspired by Bitnine's AgensGraph, a multi-model database fork of PostgreSQL. The basic principle of the project is to create a single storage that handles both the relational and graph data model so that the users can use the standard ANSI SQL along with openCypher, one of the most popular graph query languages today.



Since AGE is based on the powerful PostgreSQL RDBMS, it is robust and fully featured. AGE is optimized for handling complex connected graph data. It provides plenty of robust databases features essential to the database environment, including ACID transactions, multi-version concurrency control (MVCC), stored procedure, triggers, constraints, sophisticated…



Twitter : https://twitter.com/apache_age

LinkedIn : https://www.linkedin.com/showcase/apache-age

Official Website : https://age.apache.org

💖 💪 🙅 🚩
muhammadtahanaveed
Muhammad Taha Naveed

Posted on February 10, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related