Thursday, February 11, 2021

Neo4J Installation on CentOS

note: This was some internal documentation I wrote a couple years ago.. based on neo4j 3.5.14 for CentOS, but with some small adjustments you can perform against newer versions, and other Linux distros..

# Patch your new CentOS installation:
yum -y update
yum -y install epel-release
# I like htop
yum -y install htop

# First, you'll need the yum repository and key.
rpm --import
cat <<EOF>  /etc/yum.repos.d/neo4j.repo
name=Neo4j RPM Repository

# View available versions/editions:
yum list neo4j

# I'm going to install the latest community edition, so here we go:
yum -y install neo4j-3.5.14-1

#verify installation
rpm -qa | grep neo

# Increase the open file limits for the neo4j service

systemctl edit neo4j.service

# Paste the following values into the file and save:

* soft nofile 40000
* hard nofile 40000

#create firewall service template for neo4j bolt, http, and https protocols (modify if you do not want to allow all 3)
cat <<EOF>> /usr/lib/firewalld/services/neo4j.xml
<?xml version="1.0" encoding="utf-8"?>
  <description>Neo4j is an ACID-compliant graph database management system developed by Neo4j, Inc.  Neo4j supports clients using either the Bolt binary protocol or HTTP/HTTPS.</description>
    <port protocol="tcp" port="7687"/>
  <port protocol="tcp" port="7474"/>
  <port protocol="tcp" port="7473"/>

# Add our newly created service to the firewall, reload and verify
firewall-cmd --permanent --add-service=neo4j
firewall-cmd --reload
firewall-cmd --list-services

# If you have SELinux you'll need to do this as well:
semanage port -a -t http_port_t -p tcp 7474
semanage port -a -t http_port_t -p tcp 7473
semanage port -a -t http_port_t -p tcp 7687

# Change the default password
cd /usr/bin

neo4j-admin set-initial-password Password1

# Configure neo4j connector to allow network connections
# use an editor to modify /etc/neo4j/neo4j.conf
# uncomment the line dbms.connectors.default_listen_address= if you want to accept non-local network connections

#You should adjust your memory settings.  For recommendations see

# Add any plugins.  I can't live without APOC, so here we go:
cd /var/lib/neo4j/plugins


# and because I am connecting with SQL Server, I will need the SQL JDBC 7.x jar
cd /tmp

tar -xzf sqljdbc_7.0.0.0_enu.tar.gz
cp /tmp/sqljdbc_7.0/enu/mssql-jdbc-7.0.0.jre8.jar /var/lib/neo4j/plugins/

# I also want Advantage (SAP Sybase) JDBC:
cd /tmp
wget -O adsinstall.jar
unzip adsinstall.jar -d /tmp/ads
cp /tmp/ads/jdbc/adsjdbc.jar  /var/lib/neo4j/plugins/

# Configure neo4j service to start automatically
systemctl enable neo4j
systemctl start neo4j

No comments:

Post a Comment

Have a comment? Would love to hear it!