This article will guide you through the process of installing Neo4j on Ubuntu 22.04. We’ll break down each step, ensuring you have a smooth and successful installation. When it comes to graph databases, Neo4j stands out as a leading platform, providing a reliable and effective way to manage and query highly connected data. This open-source, NoSQL, native graph database provides an excellent foundation for all kinds of applications that need to handle rich, connected data.
Prerequisites
It’s important to make sure that your system complies with the requirements before we start the installation process.
- You need to have Ubuntu 22.04 installed on your Virtono VPS.
- You should have superuser (root) privileges or access to the ‘sudo’ command.
- You should have Java Development Kit (JDK) 11 or later installed. If not, we’ll cover the installation process.
Updating the System
First, let’s update the existing list of packages:
sudo apt update && apt upgrade -y
Installing Java Development Kit (JDK)
If you haven’t installed JDK on your system, you can install it using the following commands:
sudo apt install openjdk-11-jdk
You can verify the installation by checking the version of the installed JDK:
java -version
Adding Neo4j on Ubuntu Repository
The default Ubuntu 22.04 repositories do not contain Neo4j. As a result, we must integrate our system with the official Neo4j repository. The ‘apt-transport-https’ package must first be installed for the package manager to be able to transfer files and data over https:
sudo apt-get install apt-transport-https
Next, import the GPG key used for signing Neo4j packages:
wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -
Then, add the Neo4j repository to your system:
echo 'deb https://debian.neo4j.com stable latest' | sudo tee /etc/apt/sources.list.d/neo4j.list
Update the system’s package list:
sudo apt-get update
Installing Neo4j on Ubuntu
Now, you can install Neo4j using the following command:
sudo apt-get install neo4j
Starting and Enabling Neo4j Service
After the installation process, start the Neo4j service and enable it to launch at boot:
sudo systemctl start neo4j
sudo systemctl enable neo4j
You can verify the status of the Neo4j service using:
sudo systemctl status neo4j
Accessing Neo4j
By default, Neo4j on Ubuntu runs on localhost port 7474. Open your web browser and visit http://localhost:7474. You should see the Neo4j web interface, which means you’ve successfully installed and started Neo4j on Ubuntu.
If you’re trying to access it from a different machine, you need to configure Neo4j to allow connections from any IP, not just localhost.
Here’s how to do it:
- Open the Neo4j configuration file using a text editor. You can use nano:
sudo nano /etc/neo4j/neo4j.conf
- Look for the following lines in the file:
#server.http.listen_address=:7474 #server.http.advertised_address=:7474
- Uncomment these lines (remove the # at the beginning) and replace the “:” with “0.0.0.0:” for the first line and replace SERVER-IP with your server’s external IP, like so:
server.http.listen_address=0.0.0.0:7474
server.http.advertised_address=SERVER-IP:7474
- Save and exit the file. If you’re using nano, press Ctrl+X, then Y, and finally Enter to save and exit.
- Restart Neo4j:
sudo systemctl restart neo4j
Now, you should be able to access Neo4j on Ubuntu from any machine using the IP address of the machine where Neo4j is installed, followed by :7474. For example, http://server-ip:7474.
Final Thoughts
You have now successfully installed Neo4j on Ubuntu 22.04 with the help of this tutorial. You can now begin creating your applications, learning more about graph databases, and using connected data to its full potential.
1 Comment
Duane A Nickull · November 1, 2023 at 12:14 AM
Hi:
I noticed when I ran “sudo apt-get install neo4j” that BASH seemed to install open JDK version 19.