danielwertheim

danielwertheim


notes from a passionate developer

Developer that lives by the mantra "code is meant to be shared".

Share


Tags


Disclaimer

This is a personal blog. The opinions expressed here represent my own and not those of my employer, nor current or previous. All content is published "as is", without warranty of any kind and I don't take any responsibility and can't be liable for any claims, damages or other liabilities that might be caused by the content.

Getting Neo4j up and running on Ubuntu 14.04 and Hyper-V

Daniel WertheimDaniel Wertheim

I’m not an Ubuntu guy, and while trying to follow some guides on how to install Neo4j on an Ubuntu 14.04 machine, I failed both one and two times. This post contains the steps I had to take to get it working in Hyper-V running on Windows 8.1.

Step 1 – Get a virtual machine installed

Just head over to Ubuntu and download the ISO-installation media. Now, create a guest in Hyper-V, and point out the downloaded ISO as installation boot media.

NOTE! Before booting If you went with a Hyper-V Generation 2 you will need to open the settings for the virtual machine, and under Firmware, ensure Enable Secure Boot is false

Boot up the virtual machine to get started with the installation. Don’t forget to add Open SSH during the installation. If you do forget it, you can add it later on.

Note! Network, I have an external network setup for my virtual machines, so that they can access remote endpoints.

Step 2 – configure the VM

One guide I found useful for some tweaks was this: “Initial Server Setup with Ubuntu 14.04” Apply the ones you find applicable. You can also skip this step for now.

Note! Accessing your Ubuntu machine using its hostname will not work unless you add additional software for it, like Samba. I didn’t. For now I went with accessing it via SSH using its IP-address.

Step 3 – install Neo4j

Before continuing, ensure the JAVA prerequisite is fulfilled. Run java -version to see what version you are running. More info on how-to install JAVA and the JDKs, you can look here.

First, we need to add the Neo4j key into the apt package manager:

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

If failing, ensure you include sudo not only for wget -O - ... but also for apt-key add-

Secondly, we need to add Neo4J to the apt sources list:

sudo echo 'deb http://debian.neo4j.org/repo stable/' | sudo tee --append /etc/apt/sources.list.d/neo4j.list

Finally, install Neo4j:

sudo apt-get update<br></br>sudo apt-get install neo4j

To ensure it’s running, you can run: service neo4j-service status

returning

neo4j is running

Step 4 – configure Neo4j

You now have a working install of Neo4j, but cant externally access its web based management tool, configured to listen at http://127.0.0.1:7474. To be able to access it (please read here about Neo4j and security), we need to tweak some configuration. Read more in the docs from Neo4j.

sudo nano /etc/neo4j/neo4j-server.properties

Uncomment #org.neo4j.server.webserver.address=0.0.0.0 so that it reads org.neo4j.server.webserver.address=0.0.0.0

After saving (Ctrl-x then y) you need to restart the Neo4j service:

sudo service neo4j-service restart

You should now be able to access the web-admin UI.

A warning

When starting Neo4j you can see there’s a warning, stating:

WARNING: Max 1024 open files allowed, minimum of 40 000 recommended. See the Neo4j manual.

There are instructions in the manual on how you are supposed to fix this. The issues I have seen people have with this is, that it does not work with the neo4j user (I tried as well and failed). Instead, people switch it for root. For me that feels a bit “no, no”, but I don’t know Ubuntu and such enough. Need to investigate this for a future blog post.

Summary

Now we should have an environment for development in place. I still haven’t found a solution for the warning about the number of maximum open files. But that’s for future writings as I continue my Neo4j journey. Feel free to suggest corrections and enhancements.

Cheers,

//Daniel

Developer that lives by the mantra "code is meant to be shared".

Comments