Install Neo4j on Ubuntu 16.04

Neo4j is an extremely popular graph database. Rather than having foreign keys and select statements, you use edges and graph traversals to query the data. This method of querying data is extremely powerful in many cases such as social networks.

Prerequisite

Install java 8 as perquisite for Neo4j. Add Oracle Java PPA to your system before proceeding with the installation of Java.

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

krishna@Ubuntu16:~$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
krishna@Ubuntu16:~$

Install

Add gpg key and repository for Neo4j.

wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
echo 'deb http://debian.neo4j.org/repo stable/' > sudo /etc/apt/sources.list.d/neo4j.list
sudo apt-get install neo4j
systemctl start neo4j.service
krishna@Ubuntu16:~$ wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
[sudo] password for krishna:
--2017-10-06 21:50:44--  https://debian.neo4j.org/neotechnology.gpg.key
Resolving debian.neo4j.org (debian.neo4j.org)... 52.0.233.188, 64:ff9b::3400:e9bc
Connecting to debian.neo4j.org (debian.neo4j.org)|52.0.233.188|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4791 (4.7K) [application/octet-stream]
Saving to: ‘STDOUT’

-                                              100%[===================================================================================================>]   4.68K  --.-KB/s    in 0s

2017-10-06 21:50:45 (383 MB/s) - written to stdout [4791/4791]

OK
krishna@Ubuntu16:~$

krishna@Ubuntu16:~$ echo 'deb http://debian.neo4j.org/repo stable/' > sudo /etc/apt/sources.list.d/neo4j.list

krishna@Ubuntu16:~$ sudo apt-get install neo4j
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
 gyp javascript-common libjs-inherits libjs-jquery libjs-node-uuid libjs-underscore libssl-dev libssl-doc libuv1 libuv1-dev linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic
 linux-image-4.10.0-28-generic linux-image-extra-4.10.0-28-generic node-abbrev node-ansi node-ansi-color-table node-archy node-async node-block-stream node-combined-stream
 node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fstream node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs node-gyp node-inherits
 node-ini node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog
 node-once node-osenv node-qs node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent
 node-underscore node-which python-pkg-resources zlib1g-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
 cypher-shell daemon
The following NEW packages will be installed:
 cypher-shell daemon neo4j
0 upgraded, 3 newly installed, 0 to remove and 90 not upgraded.
Need to get 76.9 MB of archives.
After this operation, 88.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 daemon amd64 0.6.4-1 [98.2 kB]
Get:2 http://debian.neo4j.org/repo stable/ cypher-shell 1.1.2-1 [710 kB]
Get:3 http://debian.neo4j.org/repo stable/ neo4j 3.2.6 [76.0 MB]
Fetched 76.9 MB in 1min 51s (691 kB/s)
Selecting previously unselected package daemon.
(Reading database ... 263748 files and directories currently installed.)
Preparing to unpack .../daemon_0.6.4-1_amd64.deb ...
Unpacking daemon (0.6.4-1) ...
Selecting previously unselected package cypher-shell.
Preparing to unpack .../cypher-shell_1.1.2-1_all.deb ...
Unpacking cypher-shell (1.1.2-1) ...
Selecting previously unselected package neo4j.
Preparing to unpack .../archives/neo4j_3.2.6_all.deb ...
Unpacking neo4j (3.2.6) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up daemon (0.6.4-1) ...
Setting up cypher-shell (1.1.2-1) ...
Setting up neo4j (3.2.6) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
krishna@Ubuntu16:~$

Now, access the neo4j using the below URL.

http://localhost:7474/browser/

Neo4j Main Screen
Neo4j

krishna@Ubuntu16:~$ cypher-shell
username: neo4j
password: **********
Connected to Neo4j 3.2.6 at bolt://localhost:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
neo4j>
neo4j>

Conclusion:

We have successfully setup Neo4j.

Enjoy !!!

Leave a Reply

Your email address will not be published. Required fields are marked *