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.3 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.3. 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
For Java 8 to install with Neo4j, first install the
sudo apt-get -t jessie-backports install ca-certificates-java
You are now ready to install Neo4j 3.3.0, 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.3.0 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.3.0
To install Neo4j Enterprise Edition:
sudo apt-get install neo4j-enterprise=3.3.0
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
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
echo "neo4j-enterprise neo4j/question select I ACCEPT" | sudo debconf-set-selections echo "neo4j-enterprise neo4j/license note" | sudo debconf-set-selections
For upgrade of any 3.x version of Neo4j to 3.3.0, follow instructions in Chapter 5, Upgrade.
Below is a description of the steps necessary for upgrade of Neo4j 2.3 to 3.3.0.
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.3.0. 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.3.0. 2.3 databases will need to be imported to 3.3.0. 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.3.0 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_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