In continuation of my other blogs related with DevOps tools. In this blog I would like to share the installation of NEO4J 3.2.6 Graph database on Unbuntu machine.

Installation of Neo4j for ubuntu

Step1: Install JDK

We need to have JDK before installing Neo4j.

add-apt-repository ppa:webupd8team/java

=========== JDK installation ======>

vskumar@ubuntu:~$ sudo add-apt-repository ppa:webupd8team/java

Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA.

Important -> Why Oracle Java 7 And 6 Installers No Longer Work: http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html

Ubuntu 16.10 Yakkety Yak is no longer supported by Canonical (and thus, Launchpad and this PPA). The PPA supports Ubuntu 17.10, 17.04, 16.04, 14.04 and 12.04.

More info (and Ubuntu installation instructions):

– for Oracle Java 7: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

– for Oracle Java 8: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

Debian installation instructions:

– Oracle Java 7: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html

– Oracle Java 8: http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html

Oracle Java 9 (for both Ubuntu and Debian): http://www.webupd8.org/2015/02/install-oracle-java-9-in-ubuntu-linux.html

Oracle JDK 9 is now considered stable. There are currently only 64bit builds (no other builds are available for download: http://www.oracle.com/technetwork/java/javase/downloads/index.html )

More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java

Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmp_l64cwdq/secring.gpg’ created

gpg: keyring `/tmp/tmp_l64cwdq/pubring.gpg’ created

gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com

gpg: /tmp/tmp_l64cwdq/trustdb.gpg: trustdb created

gpg: key EEA14886: public key “Launchpad VLC” imported

gpg: no ultimately trusted keys found

gpg: Total number processed: 1

gpg: imported: 1 (RSA: 1)

OK

vskumar@ubuntu:~$ ^C

vskumar@ubuntu:~$

==============================>

=============== Let us update as below =====>

vskumar@ubuntu:~$ sudo apt-get -f install

Reading package lists… Done

Building dependency tree

Reading state information… Done

Correcting dependencies… Done

The following packages were automatically installed and are no longer required:

bridge-utils containerd runc ubuntu-fan

Use ‘sudo apt autoremove’ to remove them.

The following additional packages will be installed:

linux-headers-4.10.0-42-generic linux-headers-generic-hwe-16.04

The following NEW packages will be installed:

linux-headers-4.10.0-42-generic

The following packages will be upgraded:

linux-headers-generic-hwe-16.04

1 upgraded, 1 newly installed, 0 to remove and 145 not upgraded.

6 not fully installed or removed.

Need to get 682 kB of archives.

After this operation, 7,550 kB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.10.0-42-generic amd64 4.10.0-42.46~16.04.1 [680 kB]

Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-generic-hwe-16.04 amd64 4.10.0.42.44 [2,330 B]

Fetched 682 kB in 1s (494 kB/s)

Selecting previously unselected package linux-headers-4.10.0-42-generic.

(Reading database … 235799 files and directories currently installed.)

Preparing to unpack …/linux-headers-4.10.0-42-generic_4.10.0-42.46~16.04.1_amd64.deb …

Unpacking linux-headers-4.10.0-42-generic (4.10.0-42.46~16.04.1) …

Preparing to unpack …/linux-headers-generic-hwe-16.04_4.10.0.42.44_amd64.deb …

Unpacking linux-headers-generic-hwe-16.04 (4.10.0.42.44) over (4.10.0.40.42) …

Setting up rsync (3.1.1-3ubuntu1.1) …

Setting up linux-image-4.10.0-42-generic (4.10.0-42.46~16.04.1) …

Running depmod.

update-initramfs: deferring update (hook will be called later)

Examining /etc/kernel/postinst.d.

run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

update-initramfs: Generating /boot/initrd.img-4.10.0-42-generic

run-parts: executing /etc/kernel/postinst.d/pm-utils 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

run-parts: executing /etc/kernel/postinst.d/update-notifier 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

Generating grub configuration file …

Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

Found linux image: /boot/vmlinuz-4.10.0-42-generic

Found initrd image: /boot/initrd.img-4.10.0-42-generic

Found linux image: /boot/vmlinuz-4.10.0-40-generic

Found initrd image: /boot/initrd.img-4.10.0-40-generic

Found linux image: /boot/vmlinuz-4.10.0-28-generic

Found initrd image: /boot/initrd.img-4.10.0-28-generic

Found memtest86+ image: /boot/memtest86+.elf

Found memtest86+ image: /boot/memtest86+.bin

done

Setting up linux-image-extra-4.10.0-42-generic (4.10.0-42.46~16.04.1) …

run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

update-initramfs: Generating /boot/initrd.img-4.10.0-42-generic

run-parts: executing /etc/kernel/postinst.d/pm-utils 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

run-parts: executing /etc/kernel/postinst.d/update-notifier 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic

Generating grub configuration file …

Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

Found linux image: /boot/vmlinuz-4.10.0-42-generic

Found initrd image: /boot/initrd.img-4.10.0-42-generic

Found linux image: /boot/vmlinuz-4.10.0-40-generic

Found initrd image: /boot/initrd.img-4.10.0-40-generic

Found linux image: /boot/vmlinuz-4.10.0-28-generic

Found initrd image: /boot/initrd.img-4.10.0-28-generic

Found memtest86+ image: /boot/memtest86+.elf

Found memtest86+ image: /boot/memtest86+.bin

done

Setting up linux-image-generic-hwe-16.04 (4.10.0.42.44) …

Setting up linux-headers-4.10.0-42 (4.10.0-42.46~16.04.1) …

Setting up linux-headers-4.10.0-42-generic (4.10.0-42.46~16.04.1) …

Setting up linux-headers-generic-hwe-16.04 (4.10.0.42.44) …

Setting up linux-generic-hwe-16.04 (4.10.0.42.44) …

vskumar@ubuntu:~$

==================================>

Step2: Install JDK

Now, we need to install JDK9.

sudo apt install oracle-java9-installer

Once the JDK is installed, check the java version as below:

====== Check java verison =====>

vskumar@ubuntu:~$ wget -O – https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add –

–2017-12-08 08:15:11– https://debian.neo4j.org/neotechnology.gpg.key

Resolving debian.neo4j.org (debian.neo4j.org)… 52.0.233.188

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-12-08 08:15:16 (131 MB/s) – written to stdout [4791/4791]

OK

vskumar@ubuntu:~$ ^C

======= Installed JDK9 =======>

Step3: Install JDK

After
confirming Java version, Install neo4j as below:

$
java –version

=============================>

vskumar@ubuntu:~$

vskumar@ubuntu:~$
pwd

/home/vskumar

vskumar@ubuntu:~$
java --version

java
9.0.1

Java(TM)
SE Runtime Environment (build 9.0.1+11)

Java
HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

vskumar@ubuntu:~$

=============================>

Once
the JDK is confirmed as above steps.

Now,
let us start building the Neo4j setup as below steps:

Step1
for Neo4j Setup:

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

=========
Neo4j =====>

vskumar@ubuntu:~$
wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo
apt-key add -

--2017-12-08
08:15:11-- https://debian.neo4j.org/neotechnology.gpg.key

Resolving
debian.neo4j.org (debian.neo4j.org)... 52.0.233.188

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-12-08
08:15:16 (131 MB/s) - written to stdout [4791/4791]

OK

vskumar@ubuntu:~$

===============>

Step2
for Neo4j Setup:

Use
the below pipe :

echo
'deb http://debian.neo4j.org/repo stable/' >/tmp/neo4j.list

=====================>

vskumar@ubuntu:~$
echo 'deb http://debian.neo4j.org/repo stable/' >/tmp/neo4j.list

vskumar@ubuntu:~$
cat /tmp/neo4j.list

deb
http://debian.neo4j.org/repo stable/

vskumar@ubuntu:~$

====================>

Step3
for Neo4j Setup:

Then
move the below directory and check its validation:

sudo
mv /tmp/neo4j.list /etc/apt/sources.list.d

================>

vskumar@ubuntu:~$

vskumar@ubuntu:~$
sudo mv /tmp/neo4j.list /etc/apt/sources.list.d

vskumar@ubuntu:~$
ls /etc/apt/sources.list.d

docker.list
webupd8team-ubuntu-java-xenial.list

docker.list.save
webupd8team-ubuntu-java-xenial.list.save

neo4j.list

vskumar@ubuntu:~$
ls -l /etc/apt/sources.list.d

total
20

-rw-r--r--
1 root root 70 Dec 8 04:08 docker.list

-rw-r--r--
1 root root 70 Dec 8 04:08 docker.list.save

-rw-rw-r--
1 vskumar vskumar 41 Dec 8 08:18 neo4j.list

-rw-r--r--
1 root root 207 Dec 8 04:08
webupd8team-ubuntu-java-xenial.list

-rw-r--r--
1 root root 136 Dec 8 04:08
webupd8team-ubuntu-java-xenial.list.save

vskumar@ubuntu:~$
cd /etc

vskumar@ubuntu:/etc$
cd apt

vskumar@ubuntu:/etc/apt$
cd sources

bash:
cd: sources: No such file or directory

vskumar@ubuntu:/etc/apt$
cd sources.list.d

vskumar@ubuntu:/etc/apt/sources.list.d$
pwd

/etc/apt/sources.list.d

vskumar@ubuntu:/etc/apt/sources.list.d$
ls

docker.list
webupd8team-ubuntu-java-xenial.list

docker.list.save
webupd8team-ubuntu-java-xenial.list.save

neo4j.list

vskumar@ubuntu:/etc/apt/sources.list.d$

=============================>

Step4
for Neo4j Setup:

Now,
update all dependencies by :

sudo
apt-get update //

=====================
You will see the Huge output =======>

Once
its done with ‘ok’ prompt, follow below step.

Step5
for Neo4j Setup:

Now,
let us
install neo4j using

sudo
apt-get install neo4j=3.2.6

====
See the below output =====>

vskumar@ubuntu:/etc/apt/sources.list.d$

vskumar@ubuntu:/etc/apt/sources.list.d$
sudo apt-get install neo4j=3.2.6

Reading
package lists... Done

Building
dependency tree

Reading
state information... Done

The
following packages were automatically installed and are no longer
required:


bridge-utils containerd
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
runc ubuntu-fan

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 126 not upgraded.

Need
to get 76.0 MB/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://debian.neo4j.org/repo stable/ neo4j 3.2.6 [76.0 MB]

Fetched
76.0 MB in 1min 34s (801 kB/s)

Selecting
previously unselected package daemon.

(Reading
database ... 252587 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) ...

vskumar@ubuntu:/etc/apt/sources.list.d$

====================>

Step6
for Neo4j Setup:

After completing installation process we need to restart neo4j service using the below command.

$sudo
service neo4j restart

====================>

vskumar@ubuntu:/etc/apt/sources.list.d$ sudo
service neo4j restart

vskumar@ubuntu:/etc/apt/sources.list.d$ sudo
service neo4j status

neo4j.service
- Neo4j Graph Database

Loaded:
loaded (/lib/systemd/system/neo4j.service; disabled; vendor preset: e

Active:
active (running) since Fri 2017-12-08 08:46:14 PST; 7s ago

Main PID:
30856 (java)

Tasks: 8

Memory:
70.6M

CPU:
2.756s

CGroup:
/system.slice/neo4j.service

└─30856
/usr/bin/java -cp /var/lib/neo4j/plugins:/etc/neo4j:/usr/shar

Dec 08 08:46:21 ubuntu neo4j[30856]:
Directories in use:

Dec 08 08:46:21 ubuntu neo4j[30856]: home:
/var/lib/neo4j

Dec 08 08:46:21 ubuntu neo4j[30856]:
config: /etc/neo4j

Dec 08 08:46:21 ubuntu neo4j[30856]: logs:
/var/log/neo4j

Dec 08 08:46:21 ubuntu neo4j[30856]:
plugins: /var/lib/neo4j/plugins

Dec 08 08:46:21 ubuntu neo4j[30856]:
import: /var/lib/neo4j/import

Dec 08 08:46:21 ubuntu neo4j[30856]: data:
/var/lib/neo4j/data

Dec 08 08:46:21 ubuntu neo4j[30856]:
certificates: /var/lib/neo4j/certificates

Dec 08 08:46:21 ubuntu neo4j[30856]: run:
/var/run/neo4j

Dec 08 08:46:21 ubuntu neo4j[30856]:
Starting Neo4j.

=======================================>

Final
and Step7 for Neo4j Setup:

Now,We can access the Neo4j browser with the
below Url:

http://localhost:7474/browser/

Neo4j-browser

Now,
we can use for our lab practice with Cypher Queries.