<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Taha Naveed</title>
    <description>The latest articles on DEV Community by Muhammad Taha Naveed (@muhammadtahanaveed).</description>
    <link>https://dev.to/muhammadtahanaveed</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1024478%2Fc1ebe1cc-9834-4700-ae23-f571a2d011fd.png</url>
      <title>DEV Community: Muhammad Taha Naveed</title>
      <link>https://dev.to/muhammadtahanaveed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhammadtahanaveed"/>
    <language>en</language>
    <item>
      <title>POSTGRESQL and APACHE AGE installation from source (Linux, Windows and mac)</title>
      <dc:creator>Muhammad Taha Naveed</dc:creator>
      <pubDate>Fri, 10 Feb 2023 19:03:27 +0000</pubDate>
      <link>https://dev.to/muhammadtahanaveed/postgresql-and-apache-age-installation-from-source-linux-windows-and-mac-2hbd</link>
      <guid>https://dev.to/muhammadtahanaveed/postgresql-and-apache-age-installation-from-source-linux-windows-and-mac-2hbd</guid>
      <description>&lt;p&gt;&lt;a href="https://age.apache.org"&gt;Apache AGE&lt;/a&gt; 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 &lt;a href="https://bitnine.net/agensgraph/"&gt;AgensGraph&lt;/a&gt;, 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. &lt;/p&gt;

&lt;p&gt;This post will be covering installation of PostgreSQL from source and then installing AGE on top of that.&lt;/p&gt;




&lt;h2&gt;
  
  
  For Linux Users:
&lt;/h2&gt;

&lt;p&gt;I will be installing PostgreSQL version 11.17 under &lt;code&gt;~/Desktop/pgsql_11.17/pgsql&lt;/code&gt; directory.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pre-requisites:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;gcc build-essential libreadline-dev zlib1g-dev flex bison
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  PostgreSQL installation:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Download source code from here or goto terminal and type
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Desktop &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; wget https://ftp.postgresql.org/pub/source/v11.17/postgresql-11.17.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Now unzip the file using the command below.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xf&lt;/span&gt; postgresql-11.17.tar.gz &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm &lt;/span&gt;postgresql-11.17.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;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.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;postgresql-11.17 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ./configure &lt;span class="nt"&gt;--enable-debug&lt;/span&gt; &lt;span class="nt"&gt;--enable-cassert&lt;/span&gt; &lt;span class="nt"&gt;--prefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;/pgsql &lt;span class="nv"&gt;CFLAGS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"-ggdb -Og -fno-omit-frame-pointer"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Type the following command to start the build and installation process.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;make &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Adding pgsql/bin to path so that we can access commands from everywhere.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"export PATH="&lt;/span&gt;~/Desktop/postgresql-11.17/pgsql/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  PostgreSQL Initialization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Now we have to make a database cluster and own this directory under the current user to start the server.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;pgsql/data &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;chown&lt;/span&gt; &lt;span class="nv"&gt;$USER&lt;/span&gt; pgsql/data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Now initialize the database cluster.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;initdb pgsql/data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Finally, we are ready to go. Start the server by typing the following command
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pg_ctl &lt;span class="nt"&gt;-D&lt;/span&gt; pgsql/data &lt;span class="nt"&gt;-l&lt;/span&gt; logfile start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Now to stop the server, type
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pg_ctl &lt;span class="nt"&gt;-D&lt;/span&gt; pgsql/data &lt;span class="nt"&gt;-l&lt;/span&gt; logfile stop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  AGE Installation:
&lt;/h3&gt;

&lt;p&gt;Now we are ready to install AGE.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download the source code from here or clone the repo from GitHub by typing
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Desktop &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clone https://github.com/apache/age.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;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.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;age &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Now check the installation by typing. All tests should pass.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;make installcheck
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;TADAAA…. We are ready to use AGE 😎.&lt;/p&gt;
&lt;h3&gt;
  
  
  Post installation:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Change the directory to postgresql-11.17 by typing
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Desktop/postgresql-11.17/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Now we will start the server, create a new database and create extension age.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pg_ctl &lt;span class="nt"&gt;-D&lt;/span&gt; pgsql/data &lt;span class="nt"&gt;-l&lt;/span&gt; logfile start
createdb &lt;span class="nb"&gt;test
&lt;/span&gt;psql &lt;span class="nb"&gt;test

test&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="c"&gt;# CREATE EXTENSION age;&lt;/span&gt;
CREATE EXTENSION
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Per Session Instructions:
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;test&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="c"&gt;# LOAD 'age';&lt;/span&gt;
LOAD
&lt;span class="nb"&gt;test&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="c"&gt;# SET search_path = ag_catalog, "$user", public;&lt;/span&gt;
SET
&lt;span class="nb"&gt;test&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="c"&gt;# &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We are done with installation and setup phase. For more information about AGE, refer to the &lt;a href="https://age.apache.org/age-manual/master/intro/setup.html"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  For Windows Users
&lt;/h2&gt;

&lt;p&gt;If you are a windows user, you can follow the steps described in the video below.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/ddk8VX8Hm-I"&gt;
&lt;/iframe&gt;
&lt;/p&gt;


&lt;h2&gt;
  
  
  For Mac Users
&lt;/h2&gt;

&lt;p&gt;If you are a mac user, you can follow the steps described in the video below.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/0-qMwpDh0CA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;



&lt;p&gt;Follow Apache AGE on following platforms:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/apache"&gt;
        apache
      &lt;/a&gt; / &lt;a href="https://github.com/apache/age"&gt;
        age
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Graph database optimized for fast analysis and real-time data processing. It is provided as an extension to PostgreSQL.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;br&gt;
&lt;p&gt;
     &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/cef7225661434a867ffd1783ae407b383c30c9ab4e7d39ec087be73ff98e3922/68747470733a2f2f6167652e6170616368652e6f72672f6167652d6d616e75616c2f6d61737465722f5f7374617469632f6c6f676f2e706e67"&gt;&lt;img src="https://camo.githubusercontent.com/cef7225661434a867ffd1783ae407b383c30c9ab4e7d39ec087be73ff98e3922/68747470733a2f2f6167652e6170616368652e6f72672f6167652d6d616e75616c2f6d61737465722f5f7374617469632f6c6f676f2e706e67" width="30%" height="30%"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;br&gt;
&lt;h3&gt;
    &lt;a href="https://age.apache.org/age-manual/master/_static/logo.png" rel="nofollow"&gt;
        &lt;img src="https://camo.githubusercontent.com/cef7225661434a867ffd1783ae407b383c30c9ab4e7d39ec087be73ff98e3922/68747470733a2f2f6167652e6170616368652e6f72672f6167652d6d616e75616c2f6d61737465722f5f7374617469632f6c6f676f2e706e67" height="25"&gt;
    &lt;/a&gt;
    &lt;a href="https://age.apache.org/age-manual/master/_static/logo.png" rel="nofollow"&gt;
    &lt;/a&gt;
     is a leading multi-model graph database &lt;/h3&gt;
&lt;h3&gt;
Graph Processing &amp;amp; Analytics for Relational Databases&lt;/h3&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
  &lt;a href="https://github.com/apache/age/blob/master/LICENSE"&gt;
    &lt;img src="https://camo.githubusercontent.com/331e6eb0193a77b365f310e0067b47fe6ad1394aa3cc5e58d8ac074122f4258a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6170616368652f616765"&gt;
  &lt;/a&gt;
   
  &lt;a href="https://github.com/apache/age/releases"&gt;
    &lt;img src="https://camo.githubusercontent.com/c577603a4d0d959425a93c8c65572cbb7479effab9245a3b261c9829e2aa4ab1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f52656c656173652d76312e322e302d4646413530303f6c6162656c436f6c6f723d67726179267374796c653d666c6174266c696e6b3d68747470733a2f2f6769746875622e636f6d2f6170616368652f6167652f72656c6561736573"&gt;
  &lt;/a&gt;
   
  &lt;a href="https://github.com/apache/age/issues"&gt;
    &lt;img src="https://camo.githubusercontent.com/5dcfdf5499bceaa6407be071bf14d814eb2751add4afe77e498834dc8bbe1730/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6170616368652f616765"&gt;
  &lt;/a&gt;
   
  &lt;a href="https://github.com/apache/age/network/members"&gt;
    &lt;img src="https://camo.githubusercontent.com/95a87b90540a869e85932867c3efd9b79d139d197d22dedf5b7334bd4bdcb605/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6170616368652f616765"&gt;
  &lt;/a&gt;
   
  &lt;a href="https://github.com/apache/age/stargazers"&gt;
    &lt;img src="https://camo.githubusercontent.com/7503f124a5429b96f7d3b370110ae456610bed41f3ecfb8d3d9c6f4a3097a979/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6170616368652f616765"&gt;
  &lt;/a&gt;
   
  &lt;a href="https://discord.gg/NMsBs9X8Ss" rel="nofollow"&gt;
    &lt;img src="https://camo.githubusercontent.com/68b91bb04b3aef04da4c3f1311325528750166961d2fca33e7420234981a6c6a/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f313032323137373837333132373238303638302e7376673f6c6162656c3d646973636f7264267374796c653d666c617426636f6c6f723d356136366636"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;br&gt;
&lt;h2&gt;
&lt;a rel="noopener noreferrer" href="https://github.com/apache/age/img/AGE.png"&gt;&lt;img height="30" src="https://res.cloudinary.com/practicaldev/image/fetch/s--LbZtRvBZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/apache/age/img/AGE.png"&gt;&lt;/a&gt;  What is Apache AGE?&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://age.apache.org/#" rel="nofollow"&gt;Apache AGE&lt;/a&gt; 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.
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;p&gt;
&lt;a rel="noopener noreferrer" href="https://github.com/apache/age/img/age-01.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8bj5sEF0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/apache/age/img/age-01.png" width="80%" height="80%"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;br&gt;
&lt;p&gt;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…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/apache/age"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
Twitter : &lt;a href="https://twitter.com/apache_age"&gt;&lt;/a&gt;&lt;a href="https://twitter.com/apache_age"&gt;https://twitter.com/apache_age&lt;/a&gt;&lt;br&gt;&lt;br&gt;
LinkedIn : &lt;a href="https://www.linkedin.com/showcase/apache-age"&gt;&lt;/a&gt;&lt;a href="https://www.linkedin.com/showcase/apache-age"&gt;https://www.linkedin.com/showcase/apache-age&lt;/a&gt;&lt;br&gt;&lt;br&gt;
Official Website : &lt;a href="https://age.apache.org"&gt;&lt;/a&gt;&lt;a href="https://age.apache.org"&gt;https://age.apache.org&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
