PostgreSQL versions 11 & 12 are supported for AGE extension. After installing postgresql from source code make sure bin and lib folder are in your environment variable. If not you can set it as below in cmd.
Here is a step-by-step guide on how to install PostgreSQL and age extension for postgres from source.
Prerequisite:
Ubuntu must be installed in the Virtual Machine or dual boot alongside windows.
You should have ample space in your ubuntu software.
You should have already installed git. If not you can take help from here Install Git.
Install some Dependencies:
mkdir age_installation
cd age_installation
mkdir pg
cd pg
Remember below commands might vary according to the operating systems.
In the above command, the prefix flag will contain the path where you would like to install the PSQL. Replace your path with the path in the parenthesis.
AGE:
Downloading:
Download the age from the GitHub repository. i.e. clone it in the age_installation directory.
git clone https://github.com/apache/age.git
Installing:
Configure age with PostgreSQL.
cd age/
sudo make PG_CONFIG=/home/talhastinyasylum/Desktop/age_installation/pg/postgresql-11.18/bin/pg_config install
make PG_CONFIG=/home/talhastinyasylum/Desktop/age_installation/pg/postgresql-8/bin/pg_config installcheck
Database initialization:
cd postgresql-11.18/
Intitialization
bin/initdb sample
When you will execute the command the success message will be shown with the command to start the server.
Start server:
bin/pg_ctl -D sample -l logfile start
The command will return a message saying that the server has started.
Create Database:
The name of the Database is SampleDatabase
bin/createdb SampleDatabase
Start querying Database:
Now that AGE has been added to pg successfully. Now we can start testing using pg_sql console.
The above command will load the extension and we also need to set the search path and other variables.
SET search_path = ag_catalog, "$user", public;
Try below queries using cypher commands:
SELECT create_graph('demo_graph');
It will create a graph named demo_graph.
SELECT * FROM cypher('demo_graph', $$ CREATE (n:Person {name : "james", bornIn : "US"}) $$) AS (a agtype);
SELECT * FROM cypher('demo_graph', $$ CREATE (n:Person {name : "Talha", bornIn : "Lahore"}) $$) AS (a agtype)
SELECT * FROM cypher('demo_graph', $$ MATCH (n) RETURN n $$) as (a agtype);
Copy
3
Answers
PostgreSQL versions 11 & 12 are supported for AGE extension. After installing postgresql from source code make sure
bin
andlib
folder are in your environment variable. If not you can set it as below in cmd.Just replace the path with your installation directory
After that clone the age in your ubuntu. Go to the directory and run
From now on you can run AGE extension after running pgsql as follow :
Download source PostgreSQL package.
Go in PostgreSQL folder.
configure by setting flags.
Now install.
Go back.
*** CLONING AGE ***
Go in AGE cloned repo
Install
Install check
Go in Postgresql file
initialization of db named demo
Open File demo/postgresql.conf
In postgresql.conf file update
Starting db demo which we initialized earlier
Age in added to pg successfuly now we can test it, opens pg console
Here is a step-by-step guide on how to install PostgreSQL and age extension for postgres from source.
Prerequisite:
Ubuntu must be installed in the Virtual Machine or dual boot alongside windows.
You should have ample space in your ubuntu software.
You should have already installed git. If not you can take help from here Install Git.
Install some Dependencies:
Remember below commands might vary according to the operating systems.
Installation of Components from Source:
For now, age only supports Postgres 11 and 12. So downloading the required version of PostgreSQL.
Download the files in the folder age-installation/pg
Installing PG:
Now we will move toward installing PG
Configure by setting flags
Now install
Go back
In the above command, the prefix flag will contain the path where you would like to install the PSQL. Replace your path with the path in the parenthesis.
AGE:
Downloading:
Download the age from the GitHub repository. i.e. clone it in the age_installation directory.
Installing:
Configure age with PostgreSQL.
Database initialization:
Intitialization
When you will execute the command the success message will be shown with the command to start the server.
Start server:
The command will return a message saying that the server has started.
Create Database:
The name of the Database is SampleDatabase
Start querying Database:
Now that AGE has been added to pg successfully. Now we can start testing using pg_sql console.
The above command will load the extension and we also need to set the search path and other variables.
Try below queries using cypher commands:
It will create a graph named demo_graph.
The last command will return the rows in the database sample image of the output