Installing Standalone Neo4j in Ubuntu 16

As i prepare to my new role, i’d been learning a lot about Neo4j Graph Database. one of my task when i join my next company is to migrate some mysql/oracle to Neo4j.

i’ve downloaded the Enterprise version of Neo4j for my testing purposes.

Installing Java, first step before running the Neo4j

 
neo4j@lnxneo4jstln:~$sudo apt install default-jre default-jre-headless

neo4j@lnxneo4jstln:~$ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
neo4j@lnxneo4jstln:~$ 

From my download folder, i’ll extract the zip files to /opt

 
neo4j@lnxneo4jstln:/mnt/hgfs/Downloads$ sudo cp neo4j-enterprise-3.0.6-unix.tar /opt/

neo4j@lnxneo4jstln:/opt$ sudo tar -xvf neo4j-enterprise-3.0.6-unix.tar 

Lets try running it.

neo4j@lnxneo4jstln:/opt$ cd neo4j-enterprise-3.0.6/
neo4j@lnxneo4jstln:/opt/neo4j-enterprise-3.0.6$ ls
bin  conf  data  import  lib  LICENSES.txt  LICENSE.txt  logs  NOTICE.txt  plugins  README.txt  run  UPGRADE.txt

neo4j@lnxneo4jstln:/opt/neo4j-enterprise-3.0.6$ cd bin
neo4j@lnxneo4jstln:/opt/neo4j-enterprise-3.0.6/bin$ sudo ./neo4j console
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
2016-10-27 14:56:49.547+0000 INFO  No SSL certificate found, generating a self-signed certificate..
2016-10-27 14:56:51.434+0000 INFO  Starting...
2016-10-27 14:56:52.860+0000 INFO  Bolt enabled on localhost:7687.
2016-10-27 14:56:52.903+0000 INFO  Initiating metrics...
2016-10-27 14:57:00.174+0000 INFO  Started.
2016-10-27 14:57:00.616+0000 INFO  Mounted REST API at: /db/manage
2016-10-27 14:57:05.412+0000 INFO  Remote interface available at http://localhost:7474/

Since our the above steps work, lets continue with our configuration.

Below is optional, but prefer doing it so that when i change software i just need to update the link.

 
ln -s /opt/neo4j-enterprise-3.0.6 /opt/neo4j-current

In my .profile i added below.

 
export NEO4J_HOME=/opt/neo4j-current
export PATH=$PATH:$NEO4J_HOME/bin

For below warning update the limits.conf
WARNING: Max 1024 open files allowed, minimum of 40 000 recommended. See the Neo4j manual.

 
neo4j@lnxneo4jstln:sudo vi /etc/security/limits.conf

neo4j   soft    nofile  40000
neo4j   hard    nofile  40000

Now lets configure our neo4j to stop / start automatically.
Create a new file in /etc/init.d/neo4j

 
neo4j@lnxneo4jstln:sudo vi /etc/init.d/neo4j
#! /bin/sh
### BEGIN INIT INFO
# Provides: neo4j
# Required-Start
# Required-Stop
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: neo4j
# Description: This file starts and stops neo4j server
# 
### END INIT INFO
export NEO4J_HOME=/opt/neo4j-current

case "$1" in
 start)
    $NEO4J_HOME/bin/neo4j start
   ;;
 stop)
    $NEO4J_HOME/bin/neo4j stop
   ;;
 restart)
   $NEO4J_HOME/bin/neo4j restart
   ;;
 console)
   $NEO4J_HOME/bin/neo4j console
   ;;
 status)
   $NEO4J_HOME/bin/neo4j status
   ;;
 *)
   echo "Usage: neo4j {console|start|stop|restart|status}" >&2
   exit 3
   ;;
esac

neo4j@lnxneo4jstln:sudo chmod a+x neo4j

Do a simple test.

neo4j@lnxneo4jstln:/etc/init.d$ sudo ./neo4j status
Neo4j is not running

neo4j@lnxneo4jstln:/etc/init.d$ sudo ./neo4j start
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
Started neo4j (pid 6717). By default, it is available at http://localhost:7474/
There may be a short delay until the server is ready.
See /opt/neo4j-current/logs/neo4j.log for current status.

neo4j@lnxneo4jstln:/etc/init.d$ sudo ./neo4j status
Neo4j is running at pid 6717

neo4j@lnxneo4jstln:/etc/init.d$ sudo ./neo4j stop
Stopping Neo4j.. stopped

neo4j@lnxneo4jstln:/etc/init.d$ sudo ./neo4j status
Neo4j is not running
neo4j@lnxneo4jstln:/etc/init.d$ 

Now if above work, lets register it.

 
neo4j@lnxneo4jstln:sudo update-rc.d neo4j defaults

Now, restart your Machine to validate your newly installed Neo4j.

For me, i have to edit the $NEO4J_HOME/conf/neo4j.conf to allow me to access the console outside of my machine.

dbms.connector.http.address=0.0.0.0:7474

Now i can access my console on my physical machine.

screen-shot-2016-10-28-at-8-23-51-am
Welcome to my newly installed Neo4j 3.0.6

screen-shot-2016-10-28-at-8-24-21-amscreen-shot-2016-10-28-at-8-25-25-am

thank You for checking my blog.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s