Installation
APOC Core is packaged with Neo4j and can be found in the $NEO4J_HOME/labs
directory.
APOC Full can be downloaded using one of the methods described in the sections below.
APOC Full contains all the procedures and functions included in APOC Core. You must not install both libraries. |
APOC Core
APOC Core can be installed by moving the APOC jar file from the $NEO4J_HOME/labs
directory to the $NEO4J_HOME/plugins
directory and restarting Neo4j.
Neo4j Desktop
APOC Full can be installed with Neo4j Desktop, after creating your database, by going to the Manage
screen, and then the Plugins
tab.
Click Install
in the APOC box and wait until you see a green check mark near "APOC".
Neo4j Server
Since APOC relies on Neo4j’s internal APIs you need to use the matching APOC version for your Neo4j installaton. Make sure that the first two version numbers match between Neo4j and APOC.
Go to the latest release for Neo4j version 4.3 and download the binary jar to place into your $NEO4J_HOME/plugins
folder.
You can find all releases here.
After you move the jar file to the plugins folder you have to restart neo4j with neo4j restart
Since APOC relies on Neo4j’s internal APIs, you need to use the right APOC version for your Neo4j installation.
APOC uses a consistent versioning scheme: <neo4j-version>.<apoc>
version.
The trailing <apoc>
part of the version number will be incremented with every apoc release.
The version compatibility matrix explains the mapping between Neo4j and APOC versions:
apoc version | neo4j version |
---|---|
4.4.0 (4.3.x) |
|
4.3.7 (4.3.x) |
|
4.2.11 (4.2.x) |
|
4.1.11 (4.1.x) |
|
4.0.12 (4.0.x) |
|
3.5.30 (3.5.x) |
|
3.4.18 (3.4.x) |
|
3.3.9 (3.3.x) |
|
3.2.14 (3.2.x) |
|
3.1.9 (3.1.x) |
|
3.0.12 (3.0.x) |
|
3.5.0-beta01 |
|
3.4.5 |
|
3.3.5 |
|
3.2.3 |
|
3.1.5 |
If by mistake a jar not compatible with the neo4j version is inserted, a log.warn
like this will appear in neo4j.log
:
The apoc version (<APOC_VERSION>) and the Neo4j DBMS versions [NEO4J_VERSION] are incompatible.
See the compatibility matrix in https://neo4j.com/labs/apoc/4.4/installation/ to see the correct version
Docker
APOC Full can be used with the Neo4j Docker image via the NEO4JLABS_PLUGINS
environment variable.
If we use this environment variable, the APOC plugin will be downloaded and configured at runtime.
This feature is intended to facilitate using APOC in development environments, but it is not recommended for use in production environments. |
docker run \
-p 7474:7474 -p 7687:7687 \
-v $PWD/data:/data -v $PWD/plugins:/plugins \
--name neo4j-apoc \
-e NEO4J_apoc_export_file_enabled=true \
-e NEO4J_apoc_import_file_enabled=true \
-e NEO4J_apoc_import_file_use__neo4j__config=true \
-e NEO4JLABS_PLUGINS=\[\"apoc\"\] \
neo4j:4.0
We should see the following two lines in the output after running this command:
Fetching versions.json for Plugin 'apoc' from https://neo4j-contrib.github.io/neo4j-apoc-procedures/versions.json
Installing Plugin 'apoc' from https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/4.3.0.12/4.3.0.12-all.jar to /plugins/apoc.jar
In a production environment we should download the APOC release matching our Neo4j version and, copy it to a local folder, and supply it as a data volume mounted at /plugins
.
plugins
directory and then mounts that folder to the Neo4j Docker containermkdir plugins
pushd plugins
wget https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/4.3.0.12/apoc-4.3.0.12-all.jar
popd
docker run --rm -e NEO4J_AUTH=none -p 7474:7474 -v $PWD/plugins:/plugins -p 7687:7687 neo4j:4.3
If you want to pass custom apoc config to your Docker instance, you can use environment variables, like here:
docker run \
-p 7474:7474 -p 7687:7687 \
-v $PWD/data:/data -v $PWD/plugins:/plugins \
--name neo4j-apoc \
-e NEO4J_apoc_export_file_enabled=true \
-e NEO4J_apoc_import_file_enabled=true \
-e NEO4J_apoc_import_file_use__neo4j__config=true \
neo4j
Restricted procedures/functions
For security reasons, procedures that use internal APIs are disabled by default.
They can be enabled by specifying config in $NEO4J_HOME/conf/neo4j.conf
e.g. dbms.security.procedures.unrestricted=apoc.*
If you want to do this when using the Neo4j Docker container, you need to amend -e NEO4J_dbms_security_procedures_unrestricted=apoc.\\\*
to your docker run …
command.
The three backslashes are necessary to prevent wildcard expansions.
You can also whitelist procedures and functions in general to be loaded using: dbms.security.procedures.whitelist=apoc.coll.*,apoc.load.*