How do I set max open files for Debian installs

When perfoming an install of Neo4j using the Debian install kit and as detailed at https://neo4j.com/docs/operations-manual/current/deployment/single-instance/debian/, upon completion you will need to configure the linux configuration option for max files. If not configured you may encounter errors with a stack trace that includes

java.io.FileNotFoundException: /data/graph.db/schema/label/lucene/_3qn3.fdt (Too many open files) at

or similar.

To configure one needs to create/edit /etc/default/neo4j and define it to include

NEO4J_ULIMIT_NOFILE=40000

Upon start of Neo4j via

service neo4j-service start

the /etc/default/neo4j will be read and the environment variable NEO4J_ULIMIT_NOFILE will then be used in the expression

ulimit -n NEO4J_ULIMIT_NOFILE

and thus set the max open files.