Install Neo4J on Ubuntu

28/12/2020
Chưa phân loại

In this post, we will see how we can install one of the most popular Graph-based database, Neo4J on Ubuntu and start using it as well.  But first a little background information.

Neo4J Database

Neo4J is known to be the #1 Graph-based platform to store and query connected data.

Connected data is a form of data which can be best defined in the form of relationships. For example, Facebook is a social networking site with users being connected as ‘Friends’. Now, ‘Friends’ is the relationship between users which connect and define them. Neo4J is possibly a very good solution for storing and querying this kind of data.

Connected data in Neo4J can be represented as a Graph. A graph is connected set of vertices which are attached by edges. Edges represents relationships. Let’s visualize these:

The lines which connect two nodes or vertices are called edges.

Installing Java

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

java version

When we run this command, we get the following output:

We will now install Java on our system. Use this command to do so:

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

Once these commands are done running, we can again verify that Java is now installed by using the same command.

Installing Neo4J

Now, installing Neo4J is just a matter of few commands. To start, add the Neo4J to the apt package manager:

sudo wget -O – http://debian.neo4j.org/neotechnology.gpg.key
| sudo apt-key add

sudo echo ‘deb http://debian.neo4j.org/repo stable/’ >
/etc/apt/sources.list.d/neo4j.list

Next, install Neo4J:

sudo apt-get update
sudo apt-get install neo4j
service neo4j status

When we run the Neo4J service, it starts at its default port, which 7687. Once it starts, we can even visit the Neo4J panel in a browser like this:

You can visit this panel on this URL:

http://localhost:7474/browser/

Login using the default Neo4j password ‘neo4j’ and then you will be prompted to set a new password. For this example set the password to be ‘hello’.

Inserting Data in Neo4J

To finally check if we were able to install and start Neo4J on our Ubuntu machine, we will see if we can insert data and query it with Curl commands which push data to port 7474 as well.

We first insert one Person node:

curl -H "Accept: application/json; charset=UTF-8" –user "neo4j:hello" -H
"Content-Type: application/json" -X POST http://localhost:7474/db/data/cypher -d
‘{ "query" : "CREATE (n:Person { name : {name} }) RETURN n", "params" :
{ "name" : "Shubham" } }’

When we run the above command, we will see the following response:

Then another:

curl -H "Accept: application/json; charset=UTF-8" –user "neo4j:hello" -H
"Content-Type: application/json" -X POST http://localhost:7474/db/data/cypher -d
‘{ "query" : "CREATE (n:Person { name : {name} }) RETURN n", "params" :
{ "name" : "LinuxHint" } }’

As we were able to insert data into the Neo4J database, this means it was up and running on our Ubuntu machine!

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Recover Removed Files from Windows NTFS Drive using Live Ubuntu DVD

If you’ve mistakenly deleted some files from your Windows NTFS drive and would like to get them back, then this article...
29/12/2020

Ubuntu 18.04, Bionic Beaver, is Officially Released

The time has come for the official release of Ubuntu 18.04, which was promised in the 4th month of 2018 as per the Ubuntu...
28/12/2020

[Ubuntu] Hướng dẫn khôi phục tên network interface về dạng eth[x] trên Ubuntu 16.04 / 18.04

Khi mới quản trị hệ thống, bạn sẽ nhận thấy tên interface mạng mặc định trên Ubuntu theo...
30/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Tìm Hiểu Về Thuê Proxy US – Lợi Ích và Cách Sử Dụng Hiệu Quả
11/12/2024

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024