LinuxWizardry
  • Home
  • Tutorials
  • News
  • Ubuntu
  • Centos
  • Tools
No Result
View All Result
LinuxWizardry
  • Home
  • Tutorials
  • News
  • Ubuntu
  • Centos
  • Tools
No Result
View All Result
LinuxWizardry
No Result
View All Result

How to Install and Configure Neo4j on AlmaLinux

by Rohan
February 22, 2023
in Tutorials
ShareTweetShareShare

Neo4j is a popular graph database used to store and manage data in the form of graphs. Instead of rows and columns, it uses nodes and relationships to represent data.  It is a highly scalable NoSQL database system developed by Neo Technology. It is available in two editions: a free community and an enterprise for commercial solutions.

This article will explain how to install and configure Neo4j on AlmaLinux.

 

Prerequisites

We will go through a step-by-step guide for installing Neo4j on AlmaLinux. To proceed with the installation, you will need the following:

  • AlmaLinux server with an internet connection
  • Access to the sudo privileges

 

Step 1: Install Java

Neo4j is written in Java so you will need the Java Development Kit (JDK) installed on your system. The latest version of Noe4j requires the Java 17 runtime.

The first step is to install OpenJDK Java 17 on your system. To do so, run the following command.

$ sudo dnf install java-17-openjdk java-17-openjdk-devel

install openjdk 17 on alma linux

Next, verify the installation by running this command.

$ java -version

It prints the installed version of Java on the system.

check java version on alma linux

Here, you should see OpenJDK version 17. If it is showing a different version, there might be other Java versions already installed on your system.

You can change the current Java version with the help of this command.

$ sudo alternatives –config java

It will prompt you to enter the selection number of the Java version you want to set.  Select the number that points to Java version 17 and press Enter.

You can verify the change by running the Java version command.

$ java -version

 

Step 2: Set up the repository

The official package repositories of AlmaLinux do not provide the Neo4j package. You will need to add the Neo4j RPM repository and import the GPG key from Neo4j to install Neo4j.

First, run this command to import the GPG key.

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

It verifies the integrity of the packages that you will download from the Neo4j repository.

After importing the key, you have to add the Neo4j repository to the system.

Run the following command to open the file /etc/yum.repos.d/neo4j.repo in the nano editor. You can also use any other editors of your choice.

$ sudo nano /etc/yum.repos.d/neo4j.repo

Then paste the following content to the file.

[neo4j]
name=Neo4j RPM Repository
baseurl=https://yum.neo4j.com/stable/5
enabled=1
gpgcheck=1

Press Ctrl+X to exit the editor and enter y to confirm the changes.

You can verify the repository using this command.

$ sudo dnf repolist

It displays all the repositories configured on the system. You should see the added repository on the list.

check repository list on alma linux

 

Step 3: Install Neo4j

Now that you have added the repository, run the following command to install Neo4j on your AlmaLinux system.

$ sudo dnf install neo4j

It will install Neo4j from the Neo4j RPM repository.

installing neo4j on alma linux

 

Step 4: Start Neo4j Service

Once you finish the installation, it is required to start the Neo4j service for using it.

$ sudo systemctl start neo4j.service

To enable Neo4j to start automatically on boot, you can run the following:

$ sudo systemctl enable neo4j.service

You can check the status of the Neo4j service using this command.

$ sudo systemctl status neo4j.service

You will get a similar output as below.

start neo4j service on alma linux

 

Step 5: Configure Neo4j

Now that you have Neo4j installed and running, let’s configure Neo4j and connect to the Neo4j database. Neo4j provides the command-line tool ‘Cypher Shell’ for running commands and database queries.

Run this command to open the Cypher Shell.

$ cypher-shell

You will be prompted to enter the username and password. The default login credentials for Neo4j are:

  • Username: neo4j
  • Password: neo4j

Once you enter these credentials, you will be asked to set a new password. So, you have to provide a new password and confirm the password. Then you will be connected to Neo4j as user neo4j.

connect to neo4j using cypher-shell

You can enter the URL http://localhost:7474 in your browser to view the web interface of Neo4j.

web interface of neo4j

 

Step 6: Configure Neo4j for Remote Access

The default configuration of Neo4j accepts connections from localhost only. You have to edit the configuration file /etc/neo4j/neo4j.conf to accept non-local connections.

Open the configuration file in the nano editor.

$ sudo nano /etc/neo4j/neo4j.conf

Find the line #server.default_listen_address=0.0.0.0 and uncomment it by removing # symbol at the beginning. Then press Ctrl+X and enter y to save the changes and exit the editor.

The value 0.0.0.0 binds Neo4j to all the IPv4 interfaces available on your system, including localhost.

 

Step 7: Run Queries

You can run queries and administrative commands in the Cypher Shell CLI.

Open the Cypher Shell by entering the below command.

$ cypher-shell

Some queries that you can run using Cypher Shell are listed below.

Display the status of all databases

To display the status of all databases, run this query.

SHOW DATABASES;

show all databases in neo4j

Display the status of a specific database

To display the status of a database neo4j, use the below query.

SHOW DATABASE neo4j;

show the status of a specific database in neo4j

Switch a database

To switch the current database to the system, you can run this query.

:use system

 

The following examples are the administrative commands that need to be run against the system database. These commands are only supported in the Enterprise edition. If you run them in the Community Edition, you will get the message “Unsupported administrative command”.

Create a new database

The following command creates a new database alma.

CREATE DATABASE alma;

Stop a database

To shut down a database, use this command.

STOP DATABASE database_name

Start a database

To start a database that has been stopped, you can run:

START DATABASE database_name

Remove a database

To delete a database alma, you can run the following:

DROP DATABASE alma;

The cypher-shell queries are not case-sensitive but must end with a semicolon. You can find detailed information about queries in Cypher Manual.

To exit the Cypher Shell, you can use the :exit command.

:exit

 

Conclusion

That’s it! We hope this article helps you understand how to install and use the Neo4j database system on AlmaLinux. If you have any questions about this tutorial, let us know in the comment section. Happy Learning!

ShareTweetShareShare
Previous Post

How to Install and Configure Neo4j on Rocky Linux

Next Post

How to Install and Configure Open JDK and Oracle JDK on Rocky Linux

Next Post
How to Run Metabase and Nginx as a Reverse Proxy on Rocky Linux 9

How to Install and Configure Open JDK and Oracle JDK on Rocky Linux

Discussion about this post

Copyright © 2022 LinuxWizardry.com

No Result
View All Result
  • #682 (no title)

Copyright © 2022 LinuxWizardry.com

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In