DEV Community

Ahmed Mohamed
Ahmed Mohamed

Posted on • Edited on

Install PostgreSql & Apache AGE from Source

This article outlines the steps required to install Apache AGE and AGE-Viewer on a Linux system. The installation involves the following three main steps:

  • Installing Postgres from source
  • Installing and configuring Apache AGE with Postgres
  • Installing AGE-Viewer for Graphs analysis

We will discuss how to install age on Linux. Also there is a video for installing steps


mkdir age_dir
cd age_dir
mkdir pg_dir
cd pg_dir
Enter fullscreen mode Exit fullscreen mode

Before proceeding with the installation, install the necessary dependencies by following the instructions given at
https://age.apache.org/age-manual/master/intro/setup.html#pre-installation

If using Ubuntu, you can install the dependencies by running the command:

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

installing PostgreSql

Next, you will need to install an AGE-compatible version of Postgres (e.g. psql v11.18)
Downloading it and extracting it to the /age_dir/pg

wget https://ftp.postgresql.org/pub/source/v11.18/postgresql-11.18.tar.gz && tar -xvf postgresql-11.18.tar.gz && rm -f postgresql-11.18.tar.gz
Enter fullscreen mode Exit fullscreen mode

then..

cd postgresql-11.18

# configure by setting flags
./configure --enable-debug --enable-cassert --prefix=$(pwd) CFLAGS="-ggdb -Og -fno-omit-frame-pointer"

# now install
make install

# go back
cd ../../
Enter fullscreen mode Exit fullscreen mode

installing AGE

cd age/

# install
sudo make PG_CONFIG=/home/age_installation/pg/postgresql-11.18/bin/pg_config install

# install check
make PG_CONFIG=/home/age_installation/pg/postgresql-11.18/bin/pg_config installcheck
Enter fullscreen mode Exit fullscreen mode

PG_CONFIG require the path to the pg_config file. Give the path from the recently installed PostgreSQL.

DB Initialization

create new database cluster named demo

cd postgresql-11.18/

# intitialization
bin/initdb demo
Enter fullscreen mode Exit fullscreen mode

start server

create new database demodb and start the server

bin/pg_ctl -D demo -l logfile start
bin/createdb demodb
Enter fullscreen mode Exit fullscreen mode

to write queries

bin/psql demodb
Enter fullscreen mode Exit fullscreen mode

Now that you have initialized a new database, you can load the AGE extension in order to start using AGE. Run the following commands:

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

Installing AGE-Viewer

Finally, to install AGE-Viewer, install Node.js and npm by running the following command:

sudo apt install nodejs npm

cd /age_dir

git clone https://github.com/apache/age-viewer.git

Enter fullscreen mode Exit fullscreen mode

After cloning the repository, navigate to the "age-viewer" directory and set up the environment by running the following commands:

cd age-viewer

npm run setup
npm run start
Enter fullscreen mode Exit fullscreen mode

the app will be running on localhost:3000

login details

# address (default : localhost)
url: server_url;

# port_num (default 5432)
port: port_num;

# username for the database
username: username;

# password for the user
pass: password;

# database name you wanna connect to
dbname: demodb;
Enter fullscreen mode Exit fullscreen mode

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Postgres on Neon - Get the Free Plan

No credit card required. The database you love, on a serverless platform designed to help you build faster.

Get Postgres on Neon

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay