Installing Neo4j on a Raspberry Pi: A Step-by-step Guide

Jason Koo
3 min readMar 14, 2023

--

Creatively modified Lexica.art generated image by Author

Looking to build an escape room (like myself) or experiment with graph databases and want a cost-effective solution, look no further than the vaunted Raspberry Pi!

Running Neo4j on this versatile little computer can give it the ability to autonomously identify patterns in data and make real-time/optimized decisions.

This step-by-step guide will walk you through the process of installing Neo4j on a Raspberry Pi, so you can start creating your own amazing graph powered projects.

Prerequisites

  • Raspberry Pi 4 with Debian Bullseye and Raspberry Pi Desktop (2023–02–21) installed.
  • Development Laptop or Desktop with terminal / command line interface

If you’re new to working with a Raspberry Pi, I recommend using the official Raspberry Pi Imager to flash the above OS onto a micro-SD card. Afterwards, install this card into the Pi before powering it up.

Installing Java

Before installing Neo4j, you need to ensure that your Raspberry Pi has Java installed. JDK version 17+ is recommended when using Neo4j v5.5.0+.

To check if Java is installed on your Raspberry Pi, run the following command in your terminal/CLI:

java -version

You should see something like:

openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment (build 17.0.6+10-Raspbian-1deb11u1rpt1)
OpenJDK Client VM (build 17.0.6+10-Raspbian-1deb11u1rpt1, mixed mode, emulated-client)

If java is not installed run the following commands:

sudo apt update
sudo apt install default-jdk
sudo apt install openjdk-17-jdk

Installing Neo4j 5

Now that Java is installed, proceed with installing Neo4j on your Raspberry Pi.

To download the Community Edition, run the following commands:

wget -O neo4j-community-5.5.0-unix.tar.gz 'https://neo4j.com/artifact.php?name=neo4j-community-5.5.0-unix.tar.gz'
tar -xf neo4j-community-5.5.0-unix.tar.gz
cd neo4j-community-5.5.0

or the Enterprise Edition:

wget -O neo4j-enterprise-5.5.0-unix.tar.gz 'https://neo4j.com/artifact.php?name=neo4j-enterprise-5.5.0-unix.tar.gz'
tar -xf neo4j-enterprise-5.5.0-unix.tar.gz
cd neo4j-enterprise-5.5.0

License Agreement

If you are using the Enterprise Edition, you need to accept the licensing terms before you can proceed. Run either of the following commands to accept:

neo4j-admin server license --accept-commercial
neo4j-admin server license --accept-evaluation

See the official Neo4j licensing page for more details.

Running

To start a Neo4j database on the pi:

export NEO4J_HOME=~/neo4j-enterprise-5.5.0
export PATH=$NEO4J_HOME/bin:$PATH
neo4j start

A database instance will now be running on the pi. To stop it, run:

neo4j stop

Connecting

A client library is recommended for interfacing with the database by an application. Otherwise the Pi’s own web browser can also be used to access and query the database. Enter localhost:7474 into the browser address bar to connect.

New databases will have a default username is neo4j and default password of neo4j. After logging in the first time, a prompt to provide a new username/password combo will display.

Conclusion

That’s it for getting a graph database up and running on a Pi. If you’d like to setup the database for remote access or to configure systemctl to autostart a database instance see the instructions at this Gist.

If you prefer to follow a step-by-step video guide, see this Youtube video.

Good luck and happy hacking!

--

--

Jason Koo

Developer Advocate at Neo4j, technophile and former iOS Developer.