Getting Started with Apache AGE: A Comprehensive Guide (Part 1)
Tags: apacheage, postgres, graphdatabase, database
Published: 2023-04-05 08:23:53

**Introduction**
<p>
In this guide, we will walk through everything you need to know to get started with Apache AGE. Whether you’re an experienced graph database user or you’re just starting out, this guide will provide you with a detailed process to working with Apache AGE.
In this first part, we’ll cover the introduction and installation of Apache AGE. By the end of this tutorial, you should have a deep understanding of Apache AGE and have it installed.
</p>

**What is Apache AGE?**

![AGE Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rgnngkn75bnwuil76ix7.png)
<p>
Apache AGE is an open-source graph database management system that provides a powerful and scalable solution for storing, managing and analyzing large-scale graph data. It is built as an extension of PostgreSQL and supports complex graph queries and provides fast query response times, making it an excellent choice over traditional relational database management systems.
With Apache AGE, users can gain deeper insights into data and make more informed decisions. Apache AGE is a tool you won’t want to overlook as a developer, data scientist or graph expert.
</p>
**Setting up and Installation**
<div>
Apache AGE is built as an extension to PostgreSQl. Hence, you should have either PostgreSQL 11 or 12 installed on your device (AGE is only compatible with these versions as of the time of this post).
For a step-by-step guide to install the required version, click [here](https://dev.to/titoausten/easy-guide-to-install-postgresql-from-source-code-on-windows-2k60).
With PostgreSQL installed, follow the steps below to install AGE:

**1. Clone the AGE repository in the same directory where you installed PostgreSQL.**
```
git clone https://github.com/apache/age.git
```
**2. Move into the repository and change the branch to the latest version which is v1.1.0.**
```
cd age
git checkout release/PG12/1.1.0
```
**3. Make `PG_CONFIG` an environment variable and install.**
```
export PG_CONFIG=/usr/local/pgsql-12/bin/pg_config
```
Or
```
sudo make PG_CONFIG=/usr/local/pgsql-12/bin/pg_config install
```
</div>
After installation, we initialize a database cluster to set up AGE on PostgreSQL.
```
initdb age_test
```
Next, we start a server.
```
pg_ctl -D age_test -l logfile start
```
```
createdb age_testdb
```
Start up PostgreSQL, create the extension, load the extension and set the `search_path`.
```
psql age_testdb
```
```
CREATE EXTENSION age;
LOAD ‘age’;
SET search_path = ag_catalog, “$user”, public;
```
After initializing a DB, the AGE extension has to be loaded to start using it. This can be set in the `postgresql.conf` located in the DB directory which will make AGE load automatically and also set the `search_path`.
To view installed extensions:
```
\dx
```
<p>
If age is listed, then it has been successfully installed.
</p>

**Conclusion**
<p>
Setting up Apache AGE is just the first step in unlocking the power of graph data analytics. With Apache AGE, we can create complex graphs, store, manage, and query large-scale graph data with ease. As we move forward in this guide, we will explore the advanced features of Apache AGE and how to use this powerful system efficiently. In the next part, we would look at creating and analyzing graphs.
</p>

**References**
[Apache AGE website](https://age.apache.org)
[Apache AGE project](https://github.com/apache/age)