How To Install Neo4j on Fedora 41
Neo4j is a leading graph database management system prized for its ability to handle connected data efficiently. When paired with Fedora 41, it becomes a powerful solution for developers who need a stable, high-performing environment for working with graph data. This guide explains how to install Neo4j on Fedora 41 step by step, offering insights into prerequisites, repository configuration, and essential troubleshooting tips.
Graph databases are increasingly popular for use cases including social networks, recommendation engines, fraud detection, and knowledge graphs. Neo4j shines by storing data in nodes and relationships, allowing for rapid, intuitive querying. Fedora 41 is recognized for its cutting-edge packages and robust security, making it a solid choice for hosting a Neo4j server. This article provides thorough, cohesive steps to get a Neo4j instance running smoothly on Fedora 41 and includes best practices to maintain a secure, reliable environment.
Prerequisites
Before installing Neo4j on Fedora 41, it is important to confirm that your system meets the minimum requirements. Ensuring proper system readiness prevents compatibility issues and streamlines the installation process.
System Requirements
- Fedora 41: Confirm you are running the 64-bit version, as Neo4j supports 64-bit distributions.
- RAM: At least 2 GB is recommended. More is preferable for production workloads.
- CPU: A multi-core processor helps with faster queries and better concurrency.
- Disk Space: Plan to allocate enough space for the Neo4j data and logs, especially in production environments.
- Java 17 or OpenJDK 17: As of Neo4j 5.x, Java 17 is required by default.
Preparing Fedora 41
- Update system repositories:
sudo dnf update
- Install basic tools (optional but useful for retrieval and debugging):
sudo dnf install curl wget nano lsof
- Ensure you have the correct Java version. Verify by running:
java -version
If Java 17 is not installed, install OpenJDK 17:
sudo dnf install java-17-openjdk
Add the Official Neo4j Repository
Neo4j provides an official repository for Red Hat-based systems, which also includes Fedora. Adding this repository ensures you are getting secure, up-to-date RPM packages readily maintained by the Neo4j team. This step is crucial for a smooth installation experience because it aligns your system with the official software distribution channel.
According to the Neo4j Operations Manual, adding the repository involves importing the GPG key and creating a repo file pointing to their stable release channel.
Import the GPG Key
sudo rpm --import https://debian.neo4j.com/neotechnology.gpg.key
Create and Enable the Repository
cat << EOF | sudo tee /etc/yum.repos.d/neo4j.repo
[neo4j]
name=Neo4j RPM Repository
baseurl=https://yum.neo4j.com/stable/5
enabled=1
gpgcheck=1
EOF
The line baseurl=https://yum.neo4j.com/stable/5
instructs dnf
(or yum
) to pull stable channel RPMs for Neo4j 5.x. By setting gpgcheck=1, Fedora verifies the integrity of downloaded packages.
Verify the Repository
dnf repolist
Look for an entry labeled neo4j in the output. If it appears, your repository configuration was successful.
Install Neo4j
Once your system is prepared and the repository is in place, installing Neo4j is straightforward. The primary considerations are choosing between the Community Edition of Neo4j, which is free to use, or the Enterprise Edition, which requires acceptance of a commercial or evaluation license.
The Community Edition adequately covers most development requirements. However, if you need advanced features such as clustering or point-in-time backups, the Enterprise Edition may be more suitable.
Neo4j Community Edition Installation
sudo dnf install neo4j-5.x.x
Replace 5.x.x with the exact version available at the time of installation. Alternatively, you can omit the exact version and simply use:
sudo dnf install neo4j
Neo4j Enterprise Edition Installation
The Enterprise Edition installation requires explicitly accepting the license agreement. For a non-interactive install, set the environment variable NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
prior to running the command:
sudo NEO4J_ACCEPT_LICENSE_AGREEMENT=yes dnf install neo4j-enterprise-5.x.x
During installation, the system prompts for license acceptance if you have not set the environment variable. Choose between a commercial or an evaluation license, depending on your requirements.
Validate Installation
neo4j --version
This command outputs the current version of Neo4j. Confirm that the version number displayed aligns with the one you intended to install.
Initial Configuration
Correctly configuring Neo4j ensures optimal performance and security. Several key parameters can be set in the neo4j.conf
file located in /etc/neo4j/
.
Locate the Configuration File
cd /etc/neo4j
ls
Look for neo4j.conf
. This file contains critical directives for database paths, ports, and authentication. Edit it with your preferred text editor (e.g., nano
, vi
):
sudo nano neo4j.conf
Configure Default Ports
Neo4j uses distinct ports for HTTP traffic (7474) and Bolt (7687). Adjust them in neo4j.conf
if needed. For example:
dbms.connector.http.listen_address=0.0.0.0:7474
dbms.connector.bolt.listen_address=0.0.0.0:7687
Keeping defaults is often sufficient unless you expect port conflicts.
Enable or Disable Authentication
By default, Neo4j requires a password to access the database. This is recommended for production or any environment accessible over a network. Ensure:
dbms.security.auth_enabled=true
Data Store Location
If you want to separate data onto another partition or disk, set a custom path:
dbms.directories.data=/data/neo4j
Remember to create the directory and assign correct permissions to the Neo4j user if you are running in a managed environment.
Firewall Configuration
On Fedora 41, the firewalld
service manages firewall rules. To enable remote access to Neo4j, open the default ports or any custom ports you set in neo4j.conf
.
sudo firewall-cmd --add-port=7474/tcp --permanent
sudo firewall-cmd --add-port=7687/tcp --permanent
sudo firewall-cmd --reload
Leaving these ports closed is safer if accessing Neo4j only from localhost. Adjust these rules to match your security needs.
Start and Enable Neo4j Service
Neo4j installs a systemd service file for easy management. Following a successful installation, starting and enabling the service ensures your database is always ready after a reboot.
Start the Service
sudo systemctl start neo4j
Check the Service Status
sudo systemctl status neo4j
Upon successful startup, the output should show active (running). If the status is inactive or failed, examine the logs in /var/log/neo4j
.
Enable Service at Boot
sudo systemctl enable neo4j
Now Neo4j automatically starts whenever the system reboots, providing consistent availability.
Testing the Neo4j Installation
Confirmation that your installation is functioning is essential. Testing also helps you familiarize yourself with the Neo4j environment right away.
Accessing the Browser Interface
Neo4j offers a web-based interface accessible at http://localhost:7474/
. After starting the service, navigate to this URL in a web browser on the same machine or replace localhost
with your server’s IP address if you opened the ports externally:
Example: http://192.168.1.100:7474/
Use the default credentials neo4j
for username and neo4j
for password. You will be prompted to set a new password immediately, which is a recommended step for security purposes.
Using Cypher Shell
The Cypher Shell is a command line tool for interacting with Neo4j via its query language, Cypher. Install it separately if needed:
sudo dnf install cypher-shell
Connect with:
cypher-shell -u neo4j -p <YourNewPassword>
Create a Test Node
CREATE (n:Person {name: "Alice", role: "Engineer"});
This simple statement creates a node labeled Person with properties name and role. You can verify its creation:
MATCH (n) RETURN n;
Common Issues and Fixes
Sometimes, new installations encounter obstacles. Below are typical problems and recommended fixes.
Java Compatibility Problems
Ensure the installed Java version is Java 17 or OpenJDK 17. Running an earlier or unsupported version results in startup or runtime errors. Confirm your Java version with:
java -version
If needed, install or switch to the correct version:
sudo dnf install java-17-openjdk
Service Fails to Start
- Check Logs: Look at
/var/log/neo4j/neo4j.log
. The logs often indicate missing configurations or port conflicts. - Configuration File Errors: Revisit your
neo4j.conf
, especially around port assignments or memory settings. - Corrupted Install: If you suspect a corrupted package, remove and reinstall. Clearing cached packages may help:
sudo dnf clean all
Port Conflicts
If 7474 or 7687 is already in use, change them in /etc/neo4j/neo4j.conf
. Alternatively, free up the ports by stopping the conflicting service.
Locked Files or Permissions Errors
Some users have encountered “resource busy” or “EBUSY” messages. This can happen if the database or another service has locked files needed by Neo4j. Ensure no other processes are interfering, and confirm that the user running Neo4j has correct permissions on its directories .
Uninstalling Neo4j
If you no longer need Neo4j on your system, or if you wish to reinstall it from scratch, removing old files can help avoid confusion or conflicts.
Stop the Service
sudo systemctl stop neo4j
Remove the Neo4j Package
sudo dnf remove neo4j*
Remove Residual Files
Delete data and configuration directories if you are not planning to reinstall with the same data:
sudo rm -rf /var/lib/neo4j
sudo rm -rf /etc/neo4j
Additional Tips and Best Practices
- Use a Dedicated User: In production, avoid running Neo4j under the root account. Instead, create a dedicated user for enhanced security.
- Regular Backups: Configure backups or logical exports of data using
neo4j-admin
or other tools for production-grade reliability. - Monitoring and Alerting: Implement monitoring using
Prometheus
or other metrics solutions to track performance and usage. - Version Upgrades: When upgrading from a previous major or minor version, consult official upgrade paths to avoid potential data store incompatibilities.
Congratulations! You have successfully installed Neo4j. Thanks for using this tutorial for installing the Neo4j graph database management on your Fedora 41 system. For additional help or useful information, we recommend you check the official Neo4j website.