How Do You Install Neo4J on CentOS 7?

If you’re looking to harness the power of graph databases on your CentOS 7 server, installing Neo4j is an excellent place to start. Neo4j is a leading graph database management system designed to handle complex, connected data with speed and efficiency. Whether you’re developing applications that require intricate relationship mapping or analyzing networks, Neo4j’s intuitive model and robust performance make it a top choice for developers and data professionals alike.

Getting Neo4j up and running on CentOS 7 opens the door to exploring data in ways traditional relational databases can’t easily achieve. From social networks and recommendation engines to fraud detection and knowledge graphs, Neo4j’s flexible architecture supports a wide range of use cases. Understanding the installation process on CentOS 7 ensures you can quickly deploy this powerful tool in your environment and start leveraging its capabilities without hassle.

In the following sections, we’ll guide you through the essential steps to install Neo4j on CentOS 7, covering prerequisites, repository setup, and configuration tips. Whether you’re a seasoned sysadmin or new to graph databases, this overview will prepare you to integrate Neo4j smoothly into your workflow.

Installing Java on CentOS 7

Neo4j requires a compatible Java Runtime Environment (JRE) to function properly. Since CentOS 7 does not come with Java pre-installed, the first step is to install the appropriate Java version. Neo4j versions 4.x and later typically require Java 11 or newer, so OpenJDK 11 is recommended.

To install OpenJDK 11 on CentOS 7, use the following commands:

“`bash
sudo yum install -y java-11-openjdk java-11-openjdk-devel
“`

After installation, verify the Java version to ensure it’s installed correctly:

“`bash
java -version
“`

You should see output indicating that Java 11 is active, similar to:

“`
openjdk version “11.0.x” 20xx-xx-xx
OpenJDK Runtime Environment (build 11.0.x+xx)
OpenJDK 64-Bit Server VM (build 11.0.x+xx, mixed mode)
“`

If multiple Java versions exist on the system, you can configure the default version using the `alternatives` command:

“`bash
sudo alternatives –config java
“`

Select the appropriate Java 11 installation from the list.

Adding the Neo4j Repository

To ensure you install the latest stable Neo4j package, configure the official Neo4j repository. This allows for easier updates and management through the package manager.

Create a new repo file for Neo4j:

“`bash
sudo vi /etc/yum.repos.d/neo4j.repo
“`

Add the following content:

“`
[neo4j]
name=Neo4j RPM Repository
baseurl=https://yum.neo4j.com/stable
enabled=1
gpgcheck=1
gpgkey=https://yum.neo4j.com/neotechnology.gpg.key
“`

Save and exit the file. Then, import the GPG key to verify package authenticity:

“`bash
sudo rpm –import https://yum.neo4j.com/neotechnology.gpg.key
“`

Once the repository is set up, refresh the package metadata:

“`bash
sudo yum clean all
sudo yum makecache
“`

Installing Neo4j

With the repository configured, installing Neo4j is straightforward. Use the following command to install the latest stable version:

“`bash
sudo yum install -y neo4j
“`

This command installs Neo4j along with all necessary dependencies.

To confirm successful installation, check the version:

“`bash
neo4j –version
“`

Expected output resembles:

“`
neo4j 4.x.x
“`

Configuring Neo4j Service

Neo4j runs as a systemd service on CentOS 7, allowing you to manage it easily using standard service commands.

Enable Neo4j to start on system boot:

“`bash
sudo systemctl enable neo4j
“`

Start the Neo4j service immediately:

“`bash
sudo systemctl start neo4j
“`

Check the status to verify it is running without errors:

“`bash
sudo systemctl status neo4j
“`

You should see an active (running) status. If there are issues, examine logs located at `/var/log/neo4j/` for troubleshooting.

Adjusting Firewall Settings

Neo4j uses port 7474 for HTTP, 7473 for HTTPS, and 7687 for the Bolt protocol. To allow external access, update the CentOS firewall rules accordingly.

Use these commands to open the required ports:

“`bash
sudo firewall-cmd –add-port=7474/tcp –permanent
sudo firewall-cmd –add-port=7473/tcp –permanent
sudo firewall-cmd –add-port=7687/tcp –permanent
sudo firewall-cmd –reload
“`

Verify ports are open:

“`bash
sudo firewall-cmd –list-ports
“`

Expected output includes:

“`
7474/tcp 7473/tcp 7687/tcp
“`

Neo4j Configuration File Overview

Neo4j’s main configuration file is located at `/etc/neo4j/neo4j.conf`. This file controls database settings, network interfaces, authentication, and more.

Key parameters to consider include:

Parameter Description Default Value
dbms.default_listen_address IP address Neo4j binds to (use 0.0.0.0 for all interfaces) localhost
dbms.connector.bolt.enabled Enable or disable the Bolt protocol true
dbms.connector.http.enabled Enable or disable HTTP connector true
dbms.connector.https.enabled Enable or disable HTTPS connector
dbms.security.auth_enabled Enable or disable authentication true

To allow remote access, it is common to set `dbms.default_listen_address=0.0.0.0`. Always be cautious and secure your Neo4j instance when exposing it externally.

Starting and Stopping Neo4j

Use standard systemd commands to manage the Neo4j service:

  • Start the service:

“`bash
sudo systemctl start neo4j
“`

  • Stop the service:

“`bash
sudo

Preparing the CentOS 7 Environment for Neo4j Installation

Before installing Neo4j on CentOS 7, it is essential to update the system and ensure all prerequisite packages are installed. This preparation guarantees a smooth installation process and optimal performance.

Begin by updating the system packages to their latest versions:

sudo yum update -y

Next, install the required dependencies. Neo4j requires Java, specifically the OpenJDK version 11 or later. Verify if Java is installed and install it if necessary:

java -version
sudo yum install -y java-11-openjdk-devel

Confirm the default Java version is set to OpenJDK 11:

sudo alternatives --config java

Choose the appropriate Java version from the list if multiple versions are installed.

Adding Neo4j Repository and Installing Neo4j

Neo4j is not available in the default CentOS repositories. Adding the official Neo4j repository ensures access to the latest stable version.

Create a new repository configuration file for Neo4j:

sudo tee /etc/yum.repos.d/neo4j.repo <<EOF
[neo4j]
name=Neo4j Yum Repo
baseurl=https://yum.neo4j.com/stable
enabled=1
gpgcheck=1
gpgkey=https://yum.neo4j.com/neotechnology.gpg.key
EOF

Import the Neo4j GPG key to verify package authenticity:

sudo rpm --import https://yum.neo4j.com/neotechnology.gpg.key

Once the repository is configured, install Neo4j using yum:

sudo yum install -y neo4j

This command installs the Neo4j service and all necessary components.

Configuring and Starting the Neo4j Service

After installation, configure Neo4j to start automatically and adjust its settings as needed.

Enable Neo4j to start on boot:

sudo systemctl enable neo4j.service

Start the Neo4j service immediately:

sudo systemctl start neo4j.service

Verify that the service is running correctly:

sudo systemctl status neo4j.service

Neo4j’s default configuration file is located at /etc/neo4j/neo4j.conf. Common configuration adjustments include setting the listening address and enabling remote access:

Configuration Parameter Description Example Setting
dbms.default_listen_address IP address Neo4j listens on 0.0.0.0 (to listen on all interfaces)
dbms.connector.bolt.listen_address Bolt protocol listening address 0.0.0.0:7687
dbms.connector.http.listen_address HTTP protocol listening address 0.0.0.0:7474

After making changes, restart the Neo4j service to apply them:

sudo systemctl restart neo4j.service

Configuring Firewall and SELinux for Neo4j Access

To access Neo4j remotely, firewall rules and SELinux settings must permit traffic on Neo4j’s ports.

Open the necessary ports in the firewall:

sudo firewall-cmd --permanent --add-port=7474/tcp
sudo firewall-cmd --permanent --add-port=7687/tcp
sudo firewall-cmd --reload

If SELinux is enforcing, adjust the policy to allow Neo4j network communication:

sudo setsebool -P nis_enabled 1

Alternatively, you can temporarily set SELinux to permissive mode for troubleshooting:

sudo setenforce 0

Ensure to re-enable SELinux enforcing mode after confirming functionality:

sudo setenforce 1

Accessing Neo4j and Initial Setup

Neo4j is now accessible through its web interface and Bolt protocol.

Open a web browser and navigate to:

http://<server-ip>:7474

The default login credentials are:

Username Password
neo4j neo4j

Upon first login, Neo4j will prompt to change the default password. Choose a strong password to secure the database.

Neo4j can also be accessed programmatically via the Bolt protocol

Expert Insights on Installing Neo4J on CentOS 7

Dr. Elena Martinez (Senior Database Architect, GraphData Solutions). When installing Neo4J on CentOS 7, it is crucial to first ensure that your system is fully updated and that Java 8 or later is installed, as Neo4J depends heavily on the Java Virtual Machine. Using the official Neo4J repository simplifies package management and ensures you receive timely updates and security patches. Additionally, configuring the firewall to allow the default Neo4J ports (7474 and 7687) is essential for proper connectivity and remote access.

Rajesh Kumar (DevOps Engineer, CloudGraph Technologies). From a DevOps perspective, automating the Neo4J installation on CentOS 7 using shell scripts or Ansible playbooks can significantly reduce deployment time and minimize human error. It is important to verify the repository key authenticity before installation to maintain system security. Post-installation, setting up Neo4J as a systemd service ensures that the graph database starts automatically on reboot, enhancing reliability for production environments.

Linda Chen (Linux Systems Administrator, Enterprise Data Systems). When deploying Neo4J on CentOS 7, attention to SELinux policies and system resource allocation is paramount. SELinux can block Neo4J network operations if not properly configured, so setting appropriate contexts or temporarily disabling SELinux during installation may be necessary. Moreover, allocating sufficient memory and configuring swap space ensures Neo4J performs optimally, especially under heavy graph processing workloads.

Frequently Asked Questions (FAQs)

What are the prerequisites for installing Neo4J on CentOS 7?
Ensure your system has Java 8 or higher installed, sufficient memory (at least 2GB RAM recommended), and root or sudo privileges. Also, update your system packages before installation.

How do I add the Neo4J repository to CentOS 7?
Create a repository file under `/etc/yum.repos.d/` with the Neo4J repository URL, then import the Neo4J GPG key to verify package authenticity.

Which command installs Neo4J on CentOS 7?
Use `sudo yum install neo4j` after adding the repository and updating the package list to install Neo4J.

How can I start and enable Neo4J to run on boot?
Run `sudo systemctl start neo4j` to start the service and `sudo systemctl enable neo4j` to enable it at system startup.

Where can I find Neo4J configuration files on CentOS 7?
Configuration files are located in `/etc/neo4j/`, with the primary configuration file named `neo4j.conf`.

How do I verify if Neo4J is running correctly after installation?
Check the service status using `sudo systemctl status neo4j` and access the Neo4J browser interface via `http://localhost:7474` in a web browser.
Installing Neo4j on CentOS 7 involves a series of well-defined steps that ensure a smooth setup of this powerful graph database. The process typically begins with updating the system packages, followed by adding the official Neo4j repository to the system’s package manager. After importing the necessary GPG keys for package verification, the Neo4j package can be installed using the yum package manager. Once installed, configuring Neo4j to start on boot and launching the service are essential to make the database operational.

Key considerations during installation include ensuring that Java is properly installed and configured, as Neo4j depends on the Java Runtime Environment. Additionally, opening the appropriate firewall ports is crucial for accessing the Neo4j web interface and allowing remote connections if required. Proper configuration of Neo4j’s settings, such as memory allocation and security parameters, further optimizes performance and safeguards the database environment.

Overall, the installation of Neo4j on CentOS 7 is straightforward when following best practices and official guidelines. By carefully managing dependencies, repository configurations, and service management, users can leverage Neo4j’s graph database capabilities effectively. This setup provides a robust foundation for developing and deploying graph-based applications on a stable CentOS 7 platform.

Author Profile

Avatar
Barbara Hernandez
Barbara Hernandez is the brain behind A Girl Among Geeks a coding blog born from stubborn bugs, midnight learning, and a refusal to quit. With zero formal training and a browser full of error messages, she taught herself everything from loops to Linux. Her mission? Make tech less intimidating, one real answer at a time.

Barbara writes for the self-taught, the stuck, and the silently frustrated offering code clarity without the condescension. What started as her personal survival guide is now a go-to space for learners who just want to understand what the docs forgot to mention.