How to set up a neo4j graph database server on a VPS

neo4j-vps-setup-websavers

This guide will show you how to set up a Neo4j graph database server on a VPS running CentOS 7. Start by logging in to your VPS via SSH as root, then run the commands in the Neo4j yum repo set-up guide documentation. Here’s the gist of that:

Set up Repository

rpm --import https://debian.neo4j.org/neotechnology.gpg.key
cat <<EOF>  /etc/yum.repos.d/neo4j.repo
[neo4j]
name=Neo4j RPM Repository
baseurl=https://yum.neo4j.org/stable
enabled=1
gpgcheck=1
EOF

Install Neo4j

yum install neo4j-3.5.1

Change Default Password

For security reasons, it’s always best to change the defaults. The default username and password is ‘neo4j’. The following will change the password to whatever you specify by replacing NEW_PASSWORD with your actual new password value.

neo4j-admin set-initial-password NEW_PASSWORD

Important Security Note: this set-initial-password utility did not work for us and it did not provide an error. It looked like it worked fine, however the password remained at the default value of ‘neo4j’ — keep an eye out for this, particularly if you’ll be remotely accessing the database. You will need to set the neo4j user’s password using the Desktop browser software or via the neo4j console.

Remote Access

If you need to access the database remotely, such as with the Neo4j Desktop software, you will need to configure it to listen on the server’s public interface, not just localhost, by editing the configuration file for the server. Edit /etc/neo4j/neo4j.conf and look for this line:

dbms.connector.bolt.listen_address=:7687

Then change it to:

dbms.connector.bolt.listen_address=0.0.0.0:7687

Without the 0.0.0.0 it will listen only on the localhost address, making it only accessible to users and web apps running on the same server. Changing it to 0.0.0.0 tells the server daemon to listen on *all* interfaces on the server, including the public IP address.

You should now be able to connect to the neo4j server using your neo4j Desktop software.

If you’re attempting to access the neo4j server using a web application on another web server, make sure that your web server allows port 7687 outbound — this port may very well be blocked by a local firewall on the web server.

Jordan Schelew

Jordan has been working with computers, security, and network systems since the 90s and is a managing partner at Websavers Inc. As a founder of the company, he's been in the web tech space for over 15 years.
WS-Logo-only-image-large

About Websavers

Websavers provides web services like Canadian WordPress Hosting and VPS Hosting to customers all over the globe, from hometown Halifax, CA to Auckland, NZ.

If this article helped you, our web services surely will as well! We might just be the perfect fit for you.

Leave a Comment