Written in Java, Neo4j is an open-source, graph database management system. Unlike the traditional relational databases such as SQL which have tables with rows and columns, a graph database is characterized by nodes, edges, and properties. Graph databases usually offer better performance than their SQL and NoSQL counterparts.
In a graph database, data is modeled as nodes and relationships between those data nodes. Neo4j can query complex relationships with low overhead since all the nodes have references to other nodes that are related. Neo4j is available in a community edition that is free and an enterprise edition for commercial purposes.
This guide will take you through the installation of Neo4j on Ubuntu 20.04
Step 1: Update your system
We recommend updating that package index of your system before proceeding. Further.So, launch your terminal and run the following command:
$ sudo apt update
Once updated, proceed and carry on the subsequent steps.
Step 2: Install Packages
Next, we will install a few additional packages. These packages may already be present in your Ubuntu 20.04 system, but you can still run the command given below:
$ sudo apt install software-properties-common apt-transport-https ca-certificates
Step 3: Download and Add GPG Key
The Neo4j database engine isn’t included in the official Ubuntu package repository. We need to add the GPG key from Neo that will allow us to install Neo4j on Ubuntu 20.04
So, proceed and download and add the Neo4j GPG key.
$ wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -
Thereafter, add the Neo4j 4.3 repository to the sources list file.
$ echo 'deb https://debian.neo4j.com stable 4.3' | sudo tee -a /etc/apt/sources.list.d/neo4j.list
Next, refresh the package lists.
$ sudo apt update
In subsequent steps, we will focus on installing and managing the Neo4j database management service.
Step 4: Install Neo4j
In this step, we will install Neo4j. This will also download a few other dependencies needed by neo4j. Additionally, a compatible Java version will be installed on your system. Run the command:
$ sudo apt install neo4j
Once the installation is done, enable and start the Neo4j service by running the following command:
$ sudo systemctl enable neo4j.service
$ sudo systemctl start neo4j.service
Verify neo4j is installed and running successfully as shown:
$ sudo systemctl status neo4j.service
You will get the output below:
Step 5: Configure Neo4j
Now that Neo4j is up and running, we can connect to the database and set up administrator credentials. To achieve this, we will leverage the cypher-shell which is a command-line utility for running queries against the Neo4j database instance.
So, fire up the interactive shell with the command:
Once you start the shell, log in with the default credentials:
For obvious security reasons, you will be required to set a new strong password. So go along and provide a robust password.
Step 6: Connecting to the web interface
In this step, we will access the Neo4j web dashboard. So, launch your favorite web browser and visit the URL shown to access Neo4J login page.
By default, Neo4j is configured to accept only connections from localhost IP addresses. The reason behind this is to provide some added security for the database engine
To access Neo4j from an external system, edit the /etc/neo4j/neo4j.conf file, locate and uncomment the following line:
You can also specify your server’s IP address in the configuration file.
Now, to access Neo4j dashboard, use your the administrator login details. You will see the Neo4j web interface shown below:
That’s it with installing Neo4j on Ubuntu 20.04. We trust the guide was an eye-opener to getting started with neo4j on Ubuntu 20.04.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.