This article covers deploying Neo4j on Debian and Debian-based distributions like Ubuntu using the Neo4j Debian package.
To install Neo4j on Debian you need to make sure of the following:
Neo4j 3.2 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.2. Debian users can find OpenJDK 8 in backports.
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/.
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
You are now ready to install Neo4j 3.2.3 (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.
Users on Ubuntu 14.04 can add oracle Java 8 via webupd8. Note that when installing from webupd8 or any other PPA, you must install Java 8 manually before installing Neo4j. Otherwise there is a risk that Java 9 will be installed in, which is not compatible with Neo4j.
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer
Once installed, see the section called “Dealing with multiple installed Java versions” to make sure you can start Neo4j after install.
It is important that you configure your default Java version to point to Java 8, or Neo4j 3.2.3 will be unable to start.
Do so with the
First list all your installed version of Java with
Your result 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
Then set it as the default with (replacing
<java8name> with the appropriate name from above)
sudo update-java-alternatives --jre --set <java8name>
The Debian package is available from http://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 http://debian.neo4j.org/repo stable/' | sudo tee -a /etc/apt/sources.list.d/neo4j.list sudo apt-get update
To install Neo4j Community Edition:
sudo apt-get install neo4j=3.2.3
To install Neo4j Enterprise Edition:
sudo apt-get install neo4j-enterprise=3.2.3
For upgrade of any 3.x version of Neo4j to 3.2.3, follow instructions in Chapter 5, Upgrade.
Below is a description of the steps necessary for upgrade of Neo4j 2.3 to 3.2.3.
There are three steps involved in upgrading a Neo4j Debian/Ubuntu installation. First, the configuration files need to be migrated. Then the database must be imported. Finally, the database store format must be upgraded.
The configuration files have changed in 3.2.3. If you have not edited the configuration files, the Debian package will simply 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 config migration tool provided. 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
The location of databases has changed in 3.2.3. 2.3 databases will need to be imported to 3.2.3. To do this, the
neo4j-admin import command can be used. To import a database called
graph.db (the default database name in 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 3.2.3 and call it
Once a database has been imported, and the upgrade has completed successfully, the old database can be removed safely.
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
You can use the following command line to change the line in-place if you have it commented out already, as it is in the default
sudo sed -i 's/#dbms.allow_format_migration=true/dbms.allow_format_migration=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