2.3.3. Linux tarball installation

This section describes how to install Neo4j on Linux from a tarball, and run it as a console application or service.

2.3.3.1. Unix console application

  1. Download the latest release from Neo4j Download Center.

    Select the appropriate tar.gz distribution for your platform.

  2. Check that the SHA hash of the downloaded file is correct:

    1. To find the correct SHA hash, go to Neo4j Download Center and click on SHA-256 which will be located below your downloaded file.
    2. Using the appropriate commands for your platform, display the SHA-256 hash for the file that you downloaded.
    3. Ensure that the two are identical.
  3. Extract the contents of the archive, using tar -xf <filename>

    Refer to the top-level extracted directory as: NEO4J_HOME

  4. Change directory to: $NEO4J_HOME

    Run ./bin/neo4j console

  5. Stop the server by typing Ctrl-C in the console.

2.3.3.2. Linux service

If you want to run Neo4j as a system service, you can install either the Debian or RPM package.

For more information on configuring and operating the Neo4j system service, see Section 2.3.4, “Neo4j system service”.

2.3.3.3. Setting the number of open files

Linux platforms impose an upper limit on the number of concurrent files a user may have open. This number is reported for the current user and session with the ulimit -n command:

user@localhost:~$ ulimit -n
1024

It is possible that the default value of 1024 may not be not enough. This is especially true when many indexes are used or a server installation sees too many connections. Network sockets count against the limit as well. Users are therefore encouraged to increase the limit to a healthy value of 40000 or more, depending on usage patterns.

It is possible to set the limit with the ulimit command, but only for the root user, and it only affects the current session. To set the value system wide, follow the instructions for your platform.

The following steps will set the open file descriptor limit to 60000 for user neo4j under Ubuntu 16.04 LTS, Debian 8, Centos 7 or later versions of those operating systems:

  1. If you run Neo4j as a service, you must complete the following:

    1. Run the following command, which will enable you to edit the neo4j.service file:

      user@localhost:~$ sudo systemctl edit neo4j.service
    2. Append the [Service] section in the neo4j.service file:

      [Service]
      LimitNOFILE=60000
  2. If you run Neo4j as an interactive user (which can be the case for testing purposes), you must complete the following:

    1. Run the following command, which will enable you to edit the user.conf file:

      user@localhost:~$ sudo vi /etc/systemd/user.conf
    2. Uncomment and define the value for DefaultLimitNOFILE, found in the [MANAGER] section:

      [Manager]
      ...
      DefaultLimitNOFILE=60000
    3. Run the following command which will append the /etc/security/limits.conf file:

      user@localhost:~$ sudo vi /etc/security/limits.conf
      neo4j	soft	nofile	60000
      neo4j	hard	nofile	60000
  3. Reload systemd settings with the command:

    user@localhost:~$ sudo systemctl daemon-reload
  4. Reboot your machine.

After completing the above procedure, the Neo4j user will have a limit of 60000 simultaneous open files. If you continue experiencing exceptions on Too many open files or Could not stat() directory, you may have to raise the limit further.