Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Installing Neo4j on Ubuntu 16.04

DZone 's Guide to

Installing Neo4j on Ubuntu 16.04

In this tutorial, we'll show you how to install Neo4j on an Alibaba Cloud Elastic Compute Service (ECS) instance with Ubuntu 16.04.

· Database Zone ·
Free Resource

Neo4j is a rapidly growing Graph Database choice, and — as claimed by Neo4j Inc. — is the world's leading graph database. Neo4j is designed for optimizing fast management, storage, and fast traversal of nodes and relationships. It can store trillions of entities for the largest dataset imaginable while being sensitive to compact storage and is a highly scalable and consistent database with features like hot backups and extensive monitoring.

Neo4j has two editions: community edition, which is a fully functional edition and is suitable for single instance deployments, and Enterprise edition, which has all the features of community edition and extended features for performance and scalability such as clustering and online backup functionality. It has a lot of use cases like fraud detection, a recommendation engine, a network and database infrastructure monitoring system, social media, identity and access management, and artificial intelligence.Image title

Getting Started

In this tutorial, we'll show you how to install Neo4j on an Alibaba Cloud Elastic Compute Service (ECS) instance with Ubuntu 16.04.

To follow this tutorial, you will need a machine running Ubuntu 16.04 ready. For the purpose of this tutorial, we'll be using Ubuntu Server 16.04, but you can use any version of Ubuntu.

Installing Java

To install Neo4j on Ubuntu, we must install Java first. Java might not be installed by default. We can verify it using this command:

bash
java -version

After running this command, if you get a similar output like below, you need to install Java in the instance, and if Java is already installed in your instance, you can skip this step.

bash
The program 'java' can be found in the following packages:
 * default-jre
 * gcj-5-jre-headless
 * openjdk-8-jre-headless
 * gcj-4.8-jre-headless
 * gcj-4.9-jre-headless
 * openjdk-9-jre-headless
Ask your administrator to install one of them

To install Java in the instance, use the following command:

bash
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

In the last step, you'll be prompted to accept the agreement, so go ahead and comply with the terms to continue further.

Once these commands finish running, you should have Java installed on your machine. Let's verify the same using the command below:

bash
java -version

Now you should have similar output in your terminal after running the command.

bash
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

After Install Java, we can now go ahead and install Neo4j on the instance.

Installing Neo4j

To start, we need to add the Neo4j repository to the apt package manager of your instance since it doesn't come in your apt by default.

To do so, run the following command:

bash
wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
echo 'deb https://debian.neo4j.org/repo stable/' | sudo tee -a /etc/apt/sources.list.d/neo4j.list
sudo apt-get update

The above command should add Neo4j to the apt package manager. Now we need to run the following command to install the community edition of Neo4j:

bash
sudo apt-get install neo4j=<current stable version>

The command above should install the current stable version of Neo4j in your instance, and now you can start Neo4j using the following command:

bash
sudo service neo4j start

If everything went well, Neo4j should be up and running. Neo4j can be accessed using the web application, which comes in the package. To access it, open your browser and enter the following address:

http://<YOUR_IP>:7474/browser

By default, the Neo4j server doesn't listen over the internet. In order to do so, we'll need to edit the Neo4j conf file to enable the Neo4j to listen on all the network ports.

First, open the neo4j.conf in /etc/neo4j using the following command:

bash
sudo nano /etc/neo4j/neo4j.conf

Now, in the nano editor, find the line that says #dbms.connectors.default_listen_address=0.0.0.0 and uncomment it. Now save the file and exit.

Neo4j should now be able to listen on all ports. To finalize the changes, restart the neo4j server using the following command.

bash
sudo service neo4j restart

Note: If you are using a cloud ubuntu server, it might not have a browser, and you'll have to use the public IP address of the instance and make sure port 7474 is allowed in the firewall.

Neo4j should now be accessible in your browser, and you should be able to log in using the default username and password neo4j.

Image title

Conclusion

Neo4j is a fast growing platform and has extensive use cases; there are endless possibilities that can be achieved using Neo4j. You can dig deeper into using Neo4j by visiting the official documentation to solve your own use case with one of its features. However, if you are planning on using it for production workloads, you should consider getting the enterprise edition.

Topics:
alibaba cloud ,database ,storage ,tutorial ,app dev ,neo4j ,install neo4j on ubuntu ,ubuntu

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}