2.3.1. Debian

This section describes how to install Neo4j on Debian, and Debian-based distributions like Ubuntu, using the Neo4j Debian package.

This section describes the following: Installation

To install Neo4j on Debian you need to make sure of the following:

  • A Java 8 runtime is installed.
  • The repository containing the Neo4j Debian package is known to the package manager.
Prerequisites (Debian 8 and Ubuntu 14.04 only)

Neo4j 3.5 requires the Java 8 runtime. Java 8 is not included in Ubuntu 14.04 LTS or Debian 8 (jessie) and will have to be installed manually prior to installing or upgrading to Neo4j 3.5, as described below. Debian users can find OpenJDK 8 in backports.

Please note that users can no longer use Oracle Java 8 on Debian 8.

Java 8 on Debian 8
  • Add the line deb http://httpredir.debian.org/debian jessie-backports main to a file with the ".list" extension in /etc/apt/sources.list.d/. Then do apt-get update.

    echo "deb http://httpredir.debian.org/debian jessie-backports main" | sudo tee -a /etc/apt/sources.list.d/jessie-backports.list
    sudo apt-get update
  • For Java 8 to install with Neo4j, first install the ca-certificates-java package:

    sudo apt-get -t jessie-backports install ca-certificates-java

You are now ready to install Neo4j 3.5.12, which will install Java 8 automatically if it is not already installed. See the section called “Dealing with multiple installed Java versions” to make sure you can start Neo4j after install.

Java 8 on Ubuntu 14.04

You are now ready to install Neo4j 3.5.12, which will install Java 8 automatically if it is not already installed. See the section called “Dealing with multiple installed Java versions” to make sure you can start Neo4j after install.

Dealing with multiple installed Java versions

It is important that you configure your default Java version to point to Java 8, or Neo4j 3.5.12 will be unable to start. Do so with the update-java-alternatives command.

  • First list all your installed version of Java with update-java-alternatives --list

    Your results may vary, but this is an example of the output:

    java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
    java-1.8.0-openjdk-amd64 1069 /usr/lib/jvm/java-1.8.0-openjdk-amd64
  • Identify your Java 8 version, in this case it is java-1.8.0-openjdk-amd64. Then set it as the default with (replacing <java8name> with the appropriate name from above)

    sudo update-java-alternatives --jre --set <java8name>
Add the repository
  • The Debian package is available from https://debian.neo4j.org. To use the repository, follow these steps:

    wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
    echo 'deb https://debian.neo4j.org/repo stable/' | sudo tee -a /etc/apt/sources.list.d/neo4j.list
    sudo apt-get update
Install Neo4j

To install Neo4j Community Edition:

sudo apt-get install neo4j=1:3.5.12

To install Neo4j Enterprise Edition:

sudo apt-get install neo4j-enterprise=1:3.5.12

Note that the version includes an epoch version component (1:), in accordance with the Debian policy on versioning.

When installing Neo4j Enterprise Edition, you will be prompted to accept the license agreement. Once the license agreement is accepted installation begins. Your answer to the license agreement prompt will be remembered for future installations on the same system.

To forget the stored answer, and trigger the license agreement prompt on subsequent installation, use debconf-communicate to purge the stored answer:

echo purge | sudo debconf-communicate neo4j-enterprise
Non-interactive installation of Neo4j Enterprise Edition

For Neo4j Enterprise Edition, the license agreement is presented in an interactive prompt. If you require non-interactive installation of Neo4j Enterprise Edition, you can indicate that you have read and accepted the license agreement using debconf-set-selections:

echo "neo4j-enterprise neo4j/question select I ACCEPT" | sudo debconf-set-selections
echo "neo4j-enterprise neo4j/license note" | sudo debconf-set-selections Upgrade

Upgrade from Neo4j 3.x

For upgrade of any 3.x version of Neo4j to 3.5.12, follow instructions in Chapter 6, Upgrade.

Upgrade from Neo4j 2.3

Follow the steps below when upgrading a Neo4j Debian/Ubuntu installation:

  1. Upgrade to Neo4j 3.2:

    1. Migrate the configuration files.

      The configuration files changed between Neo4j versions 2.3 and 3.2. If you have not edited the configuration files, the Debian package will remove the files that are no longer necessary, and replace the old default files with new default files.

      If you have changed configuration values in your 2.3 installation, you can use the provided config migration tool. Two arguments are provided to tell the config migrator where to find the conf/ directory for the source and the destination. Both must be provided, due to the filesystem layout of the Debian packages.

      Because the Neo4j files and directories are owned by the neo4j user and adm group on Debian, it is necessary to use sudo to make sure the permissions remain intact:

      sudo -u neo4j -g adm java -jar /usr/share/neo4j/bin/tools/2.x-config-migrator.jar /var/lib/neo4j /var/lib/neo4j
    2. Import the Neo4j 2.3 database to Neo4j 3.2.

      The location of the database changed between Neo4j versions 2.3 and 3.2. The Neo4j 2.3 databases will need to be imported to Neo4j 3.2. To do this, use the neo4j-admin import command.

      For example, to import a database called graph.db (the default database name in Neo4j 2.3), use the following command:

      sudo -u neo4j neo4j-admin import --mode=database --database=graph.db --from=/var/lib/neo4j/data/graph.db

      This command will import the database located in /var/lib/neo4j/data/graph.db into Neo4j 3.2, and call it graph.db.

      Once a database has been imported, and the upgrade has completed successfully, the old database can be removed safely.

    3. Migrate the Neo4j 2.3 database to Neo4j 3.2.

      The previous import step moved the database from its old on-disk location to the new on-disk location, but it did not upgrade the store format. To do this, you must start the database service with the option to migrate the database format to the latest version.

      In neo4j.conf uncomment the option dbms.allow_upgrade=true. You can use the following command to change the line in-place if you have it commented out already, as it is in the default configuration:

      sudo sed -i 's/#dbms.allow_upgrade=true/dbms.allow_upgrade=true/' /etc/neo4j/neo4j.conf

      Start the database service with the format migration option enabled, and the format migration will take place immediately:

      sudo service neo4j start
  2. Upgrade to Neo4j 3.5.12.

    Upgrade to Neo4j 3.5.12 by following the instructions in Chapter 6, Upgrade. File locations

File locations for all Neo4j packages are documented here. Operation

Most Neo4j configuration goes into neo4j.conf.

For operating systems using systemd, some package-specific options are set in neo4j.service and can be edited using systemctl edit neo4j.service.

For operating systems that are not using systemd, some package-specific options are set in /etc/default/neo4j.

Environment variable Default value Details



Timeout in seconds when waiting for Neo4j to stop. If it takes longer than this then the shutdown is considered to have failed. This may need to be increased if the system serves long-running transactions.



Maximum number of file handles that can be opened by the Neo4j process.