23.2. Server Installation

Deployment Scenarios

As a developer, you may wish to download Neo4j and run it locally on your desktop computer. We recommend this as an easy way to discover Neo4j.

As a systems administrator, you may wish to install Neo4j using a packaging system so you can ensure that a cluster of machines have identical installs. See the section called “Linux Packages” for more information on this.

For information on High Availability, please refer to Chapter 25, High Availability.

Prerequisites

With the exception of our Windows and Mac Installers, you’ll need a Java Virtual Machine installed on your computer. We recommend that you install OpenJDK 8, Oracle Java 8 or IBM Java 8 (POWER8 only).

Setting Proper File Permissions

When installing Neo4j Server, keep in mind that the bin/neo4j executable will need to be run by some OS system user, and that user will need write permissions to some files/directories. This goes specifically for the data directory. That user will also need execute permissions on other files, such as those in the bin directory.

It is recommended to either choose or create a user who will own and manage the Neo4j Server. This user should own the entire Neo4j directory, so make sure to untar/unzip it as this user and not with sudo (UNIX/Linux/OSx) etc.

If the data directory is not writable by the user Neo4j won’t be able to write anything either to the store. As a result any logs would be appended to neo4j.log. The following error message would indicate a possible permissions issue: Write transactions to database disabled.

Windows

Windows Installer

  1. Download the version that you want from http://neo4j.com/download/.

    • Select the appropriate version and architecture for your platform.
  2. Double-click the downloaded installer file.
  3. Follow the prompts.
[Note]Note

The installer will prompt to be granted Administrator privileges. Newer versions of Windows come with a SmartScreen feature that may prevent the installer from running — you can make it run anyway by clicking "More info" on the "Windows protected your PC" screen.

[Tip]Tip

If you install Neo4j using the windows installer and you already have an existing instance of Neo4j the installer will select a new install directory by default. If you specify the same directory it will ask if you want to upgrade. This should proceed without issue although some users have reported a JRE is damaged error. If you see this error simply install Neo4j into a different location.

Windows Console Application

  1. Download the latest release from http://neo4j.com/download/.

    • Select the appropriate Zip distribution.
  2. Right-click the downloaded file, click Extract All.
  3. Change directory to top-level extracted directory.

    • Run bin\neo4j console
  4. Stop the server by typing Ctrl-C in the console.
[Note]Note

Some users have reported problems on Windows when using the ZoneAlarm firewall. If you are having problems getting large responses from the server, or if the web interface does not work, try disabling ZoneAlarm. Contact ZoneAlarm support to get information on how to resolve this.

Windows service

Neo4j can also be run as a Windows service. Install the service with bin\neo4j install-service and start it with bin\neo4j start. Other commands available are stop, restart, status and uninstall-service.

Linux

Linux Packages

After installation you may have to do some platform specific configuration and performance tuning. For that, refer to Section 24.3, “Performance Guide”.

Unix Console Application

  1. Download the latest release from http://neo4j.com/download/.

    • Select the appropriate tar.gz distribution for your platform.
  2. Extract the contents of the archive, using: tar -xf <filename>

    • Refer to the top-level extracted directory as: NEO4J_HOME
  3. Change directory to: $NEO4J_HOME

    • Run: ./bin/neo4j console
  4. Stop the server by typing Ctrl-C in the console.

Linux Service

The neo4j command can also be used with start, stop, restart or status instead of console. By using these actions, you can create a Neo4j service. See the neo4j man page for further details.

[Caution]Caution

This approach to running Neo4j as a service is deprecated. We strongly advise you to run Neo4j from a package where feasible.

You can build your own init.d script. See for instance the Linux Standard Base specification on system initialization, or one of the many samples and tutorials.

Mac OSX

Mac OSX Installer

  1. Download the .dmg installer that you want from http://neo4j.com/download/.
  2. Click the downloaded installer file.
  3. Drag the Neo4j icon into the Applications folder.
[Tip]Tip

If you install Neo4j using the Mac installer and already have an existing instance of Neo4j the installer will ensure that both the old and new versions can co-exist on your system.

Running Neo4j from the Terminal

The server can be started in the background from the terminal with the command neo4j start, and then stopped again with neo4j stop. The server can also be started in the foreground with neo4j console — then its log output will be printed to the terminal.

The neo4j-shell command can be used to interact with Neo4j from the command line using Cypher. It will automatically connect to any server that is running on localhost with the default port, otherwise it will show a help message. You can alternatively start the shell with an embedded Neo4j instance, by using the -path path/to/data argument — note that only a single instance of Neo4j can access the database files at a time.

OSX Service

Use the standard OSX system tools to create a service based on the neo4j command.

A note on Java on OS X Mavericks

Unlike previous versions, OS X Mavericks does not come with Java pre-installed. You might encounter that the first time you run Neo4j, where OS X will trigger a popup offering you to install Java SE 6.

Java SE 6 or 7 is incompatible with Neo4j 3.1.0-SNAPSHOT, so we strongly advise you to skip installing Java SE 6 or 7 if you have no other uses for it. Instead, for Neo4j 3.1.0-SNAPSHOT we recommend you install Java SE 8 from Oracle (http://www.oracle.com/technetwork/java/javase/downloads/index.html) as that is what we support for production use.

Multiple Server instances on one machine

Neo4j can be set up to run as several instances on one machine, providing for instance several databases for development.

For how to set this up, see the section called “Alternative setup: Creating a local cluster for testing”. Just use the Neo4j edition of your choice, follow the guide and remember to not set the servers to run in HA mode.