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

Kali Linux Forensics Tools

Kali Linux is a powerful Operating system especially designed for Penetration Tester and Security Professionals. Most of...
29/12/2020

10 Best RSS Readers for Ubuntu

Even if most of the tech experts actively claim that RSS (Rich Site Summary) is dead especially after Google Reader was...
28/12/2020

MusicBrainz Picard 1.4 released – Install MusicBrainz Picard on Linux

MusicBrainz Picard 1.4 recently released, is a cross-platform music tagger which is written in Python. Furthermore, it supports...
28/12/2020
Bài Viết

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

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024