How to Install Neo4j on Ubuntu 22.04 / 20.04

How to Install Neo4j on Ubuntu 22.04 / 20.04. In this post, we introduce Neo4j, and its advantages, then show you how to install Neo4j on Ubuntu 22.04 / 20.04.

Neo4j is a NoSQL database system that investigates correlation within intricately linked entities. By highlighting the data relationship more, the structure overcomes the drawbacks of relational databases. The Neo4j Technique helps with more gradual connectivity research and offers solutions to challenging queries regarding the interrelationships between data points.

What is a Neo4j?

Moreover, Neo4j is a specifically designed database for storing and exploring relationships on computers. In a network structure, it stores nodes and relationships rather than tables or documents for semantic queries. The nodes are used to maintain data entities for users, including companies, or any important data a company wants to store. For users to comprehend the relationship between the different entities, the edges are employed to maintain that relationship. Data collection allows for highly flexible data analysis and application as a specified model does not restrict it.

Well, Neo4j node possess different kinds of relationships while an edge always consists of a start node, a type, an end node, and a direction. The parent child connection, actions, and ownership all be represented by an edge node. Most businesses use graph based databases to obtain precise and detailed data and handle difficult queries regarding their customers’ and users’ inputs.

Advantages of Neo4j

Neo4j has many advantages. Some of them are listed below:


Extremely adaptable and has no difficulties handling complicated and evolving data structures. Therefore, Neo4j is perfect for situations in which the data model is dynamic or where there are many to many interactions between entities.


Performs complex queries very quickly, even on very large datasets, because it is optimised for handling complex relationships.


Since Neo4j is a horizontally scalable database, its cluster can be enlarged to support more nodes. As a result, managing enormous amounts of data is possible without sacrificing quality.

Query language for graphs

Simple to express complex queries in a manner that is comprehended by developers and data analysts due to Neo4j’s use of the graph based query language Cypher.

Improved accessibility and fault tolerance

Provides high availability and fault tolerance, so even if one node in the cluster goes down, the remainder of the system continues to operate normally.

Immediate assessment

An additional key benefit of Neo4j is its potential for real time analysis of sizable datasets. As a result, organisations make real time, data driven decisions and quickly spot patterns.

Features of Neo4j

Data model (flexible schema)

Additionally, Neo4j complies with a data structure known as the property graph model. Nodes which are entities, are connected by the relationship. Both, Nodes and relationships use key value pairs named properties to store information. Properties are key value pairs that nodes and relationships employ to store data. Conforming to a predetermined schema is unnecessary, and you are free to add or subtract properties in compliance with the situation. Moreover, Neo4j provides schema restrictions.

ACID Property

Promotes ACID properties: Consistency, Isolation, Durability, and Atomicity.


Offers you to extend the database without affecting the integrity of data or query processing speed by increasing the read/write operations and volume.


Neo4j offers replication for data security and reliability.

Cypher Query Language

What is more, Neo4j offers a rich declarative query language named Cypher. Instead of using vector images, graphics are displayed using ASCII art. Cypher creates and obtains relationships between data, unlike more complex queries like Joins, which are difficult to comprehend.

Built in Web applications

Generate and view your graph data using the “built in Neo4j browser web application” from Neo4j.


Neo4j employs the “Property Graph Data Model”.

The main question in this article is about How to Install Neo4j on Ubuntu 22.04 / 20.04 is the install step. Let’s explore this next. 

How to Install Neo4j on Ubuntu 22.04 / 20.04

In this section, we will show you how to install Neo4j on Ubuntu 22.04 / 20.04 server.


  • A server running Ubuntu 22.04 or 20.04
  • A root user or a user with sudo privileges.

Install Required Dependencies

Before starting, you need to install some dependent packages on your server. First, update and upgrade all the system packages using the following command.

					apt update -y
apt upgrade -y

Then, install other required packages using the following command.

					apt install curl wget gnupg2 -y

After the successful installation, you also need to install Java JDK on your server. Install it with the following command.

					apt install default-jdk -y

After the Java installation, verify the Java version with the following command.

					java --version

You see the Java version in the following output.

					openjdk 11.0.17 2022-10-18
OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu222.04)
OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu222.04, mixed mode, sharing)

Once you are done, please proceed to install the Neo4j server.

Install Neo4j Server

By default, the Neo4j package is not available in the APT repository. So you need to add its official repo to the APT sources file.

First, download and import the GPG key using the following command.

					curl -fsSL | gpg --dearmor -o /usr/share/keyrings/neo4j.gpg

Next, add the Neo4j repository to APT with the following command.

					echo "deb [signed-by=/usr/share/keyrings/neo4j.gpg] stable 4.1" | tee -a /etc/apt/sources.list.d/neo4j.list

Then, update the repository and install the Neo4j with the following command.

					apt update -y
apt install neo4j -y

Once the Neo4j package is installed, please verify the Neo4j version using the following command.

					neo4j version

You see the Neo4j version information in the following output.

					neo4j 4.1.12

At this point, the Neo4j is installed on your server. Now proceed to the next step.

Manage Neo4j Service

By default, the Neoj4 service is managed by systemd. Manage it easily via systemctl command line tool. Firstly, start the Neo4j service using the following command.

					systemctl start neo4j

After, enable the Neo4j service to start at system reboot.

					systemctl enable neo4j

Now, verify the status of Neo4j service using the following command.

					systemctl status neo4j

See the Neo4j running status on the following screen.

Once you are done, proceed to connect the Neo4j server.

Connect Neo4j from CLI

Additionally, Neo4j comes with a command line shell called cypher-shell that allows you to connect to Neo4j via the command line interface.

Open your command line interface and connect to the Neo4j interface using the following command.


You will be asked to provide a username and password to connect the Neo4j shell. Provide the default username as neo4j, password as neo4j then press the Enter key to connect to the Neo4j interface as shown below.

Type the following command if you want to see the help information page:


You should see the following screen.

To exit from the Neo4j shell, run the following command.


Once you are finished proceed to the next step.

Enable Neo4j Remote Login

By default, Neo4j is accessed only from the local machine. Enable the remote login by editing the Neo4j default configuration file.

					nano /etc/neo4j/neo4j.conf

Change the following line:


Save and close the file then restart the Neo4j service to apply the changes.

					systemctl restart neo4j

Once the Neo4j service is restarted. Following that, please proceed to the next step.

Configure UFW Firewall

Next, you need to allow Neo4j ports 7687 and 7474 via the UFW firewall. Allow them with the following command.

					ufw allow 7687/tcp
ufw allow 7474/tcp


Next, reload the UFW firewall to implement the changes.

					ufw reload

Check the status of the added rules using the following command.

					ufw status

This shows you the list of all added ports in the following output.

					Status: active

To Action From
-- ------ ----
22/tcp ALLOW Anywhere
7687/tcp ALLOW Anywhere
7474/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
7687/tcp (v6) ALLOW Anywhere (v6)
7474/tcp (v6) ALLOW Anywhere (v6)


Once the UFW firewall is configured, proceed to the next step.

Access Neoj4 Dashboard

At this point, the Neo4j is installed and configured on your server. Go ahead and access it using the URL http://your-server-ip:7474. Also, see the Neo4j login screen.

Provide your Neo4j admin username, password and click on the Connect button. You should see the Neo4j web dashboard on the following screen.

Thank you for your time with following our article How to Install Neo4j on Ubuntu 22.04 / 20.04. We shall now conclude it. 

How to Install Neo4j on Ubuntu 22.04 / 20.04 Conclusion

In summary, we showed you how to install Neo4j on Ubuntu 22.04 / 20.4 server. Additionally, we have also explained how to access Neo4j web UI from the remote machine. Lastly, Neo4j is a strong platform designed to handle complex and dynamic data structures. A few companies and organisations prefer it due to its adaptability, speed, scalability, graph based query language, high availability, and fault tolerance. Summing up, Neo4j makes navigating complex relationships simple and uses advanced analytics by modelling data as a graph.

Overall, Neo4j is excellent for real time analysis. Large datasets may be analysed in real time, enabling businesses to see patterns and make data driven choices in real time quickly.

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x