18.1. Server Installation

18.1.1. As a Windows service
18.1.2. Linux Service
18.1.3. Mac OSX
18.1.4. Multiple Server instances on one machine

Neo4j can be installed as a server, running either as a headless application or system service.

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

    • select the appropriate version for your platform
  2. Extract the contents of the archive

    • refer to the top-level extracted directory as NEO4J_HOME
  3. Use the scripts in the bin directory

    • for Linux/MacOS, run $NEO4J_HOME/bin/neo4j start
    • for Windows, double-click on %NEO4J_HOME%\bin\Neo4j.bat
  4. Refer to the packaged information in the doc directory for details

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

18.1.1. As a Windows service

With administrative rights, Neo4j can be installed as a Windows service.

  1. Click Start → All Programs → Accessories
  2. Right click Command Prompt → Run as Administrator
  3. Provide authorization and/or the Administrator password
  4. Navigate to %NEO4J_HOME%
  5. Run bin\Neo4j.bat install

To uninstall, run bin\Neo4j.bat remove as Administrator.

To query the status of the service, run bin\Neo4j.bat status

To start the service from the command prompt, run bin\Neo4j.bat start

To stop the service from the command prompt, run bin\Neo4j.bat stop

[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 Webadmin does not work, try disabling ZoneAlarm. Contact ZoneAlarm support to get information on how to resolve this.

18.1.2. Linux Service

Neo4j can participate in the normal system startup and shutdown process. The following procedure should work on most popular Linux distributions:

  1. cd $NEO4J_HOME
  2. sudo ./bin/neo4j install

    if asked, enter your password to gain super-user privileges

  3. service neo4j-service status

    should indicate that the server is not running

  4. service neo4j-service start

    will start the server

During installation you will be given the option to select the user Neo4j will run as. You will be asked to supply a username (defaulting to neo4j) and if that user is not present on the system it will be created as a system account and the $NEO4J_HOME/data directory will be chown'ed to that user.

You are encouraged to create a dedicated user for running the service and for that reason it is suggested that you unpack the distribution package under /opt or your site specific optional packages directory.

After installation you may have to do some platform specific configuration and performance tuning. For that, refer to Section 22.9, “Linux specific notes”.

Finally, note that if you chose to create a new user account, on uninstall you will be prompted to remove it from the system.

18.1.3. Mac OSX

via Homebrew

Using Homebrew, to install the latest stable version of Neo4j Server, issue the following command:

brew install neo4j && neo4j start

This will get a Neo4j instance running on http://localhost:7474. The installation files will reside in ls /usr/local/Cellar/neo4j/community-{NEO4J_VERSION}/libexec/ — to tweak settings and symlink the database directory if desired.

as a Service

Neo4j can be installed as a Mac launchd job:

  1. cd $NEO4J_HOME
  2. ./bin/neo4j install
  3. launchctl list | grep neo

    should reveal the launchd "org.neo4j.server.7474" job for running the Neo4j Server

  4. ./bin/neo4j status

    should indicate that the server is running

  5. launchctl stop org.neo4j.server.7474

    should stop the server.

  6. launchctl start org.neo4j.server.7474

    should start the server again.

18.1.4. 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. To configure, install two instances of the Neo4j Server in two different directories following the steps outlined below.

First instance

First, create a directory to hold both database instances, and unpack the development instance:

  1. cd $INSTANCE_ROOT
  2. mkdir -p neo4j
  3. cd neo4j
  4. tar -xvzf /path/to/neo4j-community.tar.gz
  5. mv neo4j-community dev

Next, configure the instance by changing the following values in dev/conf/neo4j-server.properties, see even Section 25.1, “Securing access to the Neo4j Server”:

org.neo4j.server.webserver.port=7474

# Uncomment the following if the instance will be accessed from a host other than localhost.
org.neo4j.server.webserver.address=0.0.0.0

Before running the Windows install or startup, change in dev/conf/neo4j-wrapper.properties

# Name of the service for the first instance
wrapper.name=neo4j_1

Start the instance:

dev/bin/neo4j start

Check that instance is available by browsing to http://localhost:7474/webadmin/

Second instance (testing, development)

In many cases during application development, it is desirable to have one development database set up, and another against which to run unit tests. For the following example, we are assuming that both databases will run on the same host.

Now create the unit testing second instance:

  1. cd $INSTANCE_ROOT/neo4j
  2. tar -xvzf /path/to/neo4j-community.tar.gz
  3. mv neo4j-community test

Next, configure the instance by changing the following values in test/conf/neo4j-server.properties to

  • change the server port to 7475
# Note the different port number from the development instance
org.neo4j.server.webserver.port=7475

# Uncomment the following if the instance will be accessed from a host other than localhost
org.neo4j.server.webserver.address=0.0.0.0

Differentiate the instance from the development instance by modifying test/conf/neo4j-wrapper.properties.

wrapper.name=neo4j-test

On Windows, you even need to change the name of the service in bin\neo4j.bat to be able to run it together with the first instance.

set serviceName=Neo4j-Server-test
set serviceDisplayName=Neo4j-Server-test

Start the instance:

test/bin/neo4j start

Check that instance is available by browsing to http://localhost:7475/webadmin/