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.
- For Windows, see the section called “Windows”.
- For Unix/Linux, see the section called “Linux”.
- For OSX, see the section called “Mac OSX”.
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
-
Download the version that you want from http://neo4j.com/download/.
- Select the appropriate version and architecture for your platform.
- Double-click the downloaded installer file.
- Follow the prompts.
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 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 |
Windows Console Application
-
Download the latest release from http://neo4j.com/download/.
- Select the appropriate Zip distribution.
- Right-click the downloaded file, click Extract All.
-
Change directory to top-level extracted directory.
-
Run
bin\neo4j console
-
Run
- Stop the server by typing Ctrl-C in the console.
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
- For Debian packages, see the instructions at http://debian.neo4j.org/.
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
-
Download the latest release from http://neo4j.com/download/.
- Select the appropriate tar.gz distribution for your platform.
-
Extract the contents of the archive, using:
tar -xf <filename>
-
Refer to the top-level extracted directory as:
NEO4J_HOME
-
Refer to the top-level extracted directory as:
-
Change directory to:
$NEO4J_HOME
-
Run:
./bin/neo4j console
-
Run:
- 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 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
- Download the .dmg installer that you want from http://neo4j.com/download/.
- Click the downloaded installer file.
- Drag the Neo4j icon into the Applications folder.
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.