Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

  不多说,直接上干货!

说在前面的话

   首先,查看下你的操作系统的版本。

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:~# cat /etc/issue
Ubuntu 14.04.4 LTS \n \l root@zhouls-virtual-machine:~#

  Neo4j 是一个NoSQL的图形数据库(Graph Database)。Neo4j使用图(graph)相关的概念来描述数据模型,把数据保存为图中的节点以及节点之间的关系。很多应用中数据之间的关系,可以很直接地使用图中节点和关系的概念来建模。对于这样的应用,使用 Neo4j 来存储数据会非常的自然,要优于使用关系数据库。

  

官方文档对Neo4j的介绍如下所示:

  Neo4j is the world’s leading graph database. It is built from the ground up to be a graph database, meaning that its architecture is designed for optimizing fast management, storage, and traversal of nodes and relationships. Therefore, relationships are said to be first class citizens in Neo4j. An operation known in the relational database world as a join exhibits performance which degrades exponentially with the number of relationships. The corresponding action in Neo4j is performed as navigation from one node to another; an operation whose performance is linear.

  Neo4j分社区版(Community Edition)和企业版(Enterprise Edition),社区版本为免费版本。目前的最新版本为Neo4j 3.2。

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

  官方网址为https://neo4j.com/ Neo4j的相关文档URL地址如下

https://neo4j.com/docs/developer-manual/3.2/

https://neo4j.com/docs/operations-manual/3.2/

https://neo4j.com/docs/developer-manual/3.2/cypher/

System requirements

  Neo4j的安装对硬件、系统等有一些要求,例如CPU、Memory、Disk、Filesystem、Software等

CPU

  关于CPU,最低要求是Itel Core i3 推荐使用Intel Core i7 或 IBM POWER 8

Memory

  关于Memory,最低要求是2GB, 推荐是16-32GB 或更多。 越大的内存允许处理越大的图,但必须正确配置,以免破垃圾收集坏性操作。

Disk

  除了Disk的容量,Disk的性能对Neoj4的影响非常大,Neo4j的工作负载倾向于随机读。选择平均寻址时间低的存储,例如SSD

  最低要求 10GB SATA

  推荐配置 SSD w/SATA

FileSystem

  最低要求 ext4(或类似的)

  推荐配置 ext4、ZFS

Software

  Java

  必须安装OpenJDK 8 或 Oracle Java 8

Operation Sytem

  Linux(Ubuntu, Debian) ,但是我的测试环境为Red Hat Enterprise Linux Server release 6.6,暂时还没有发现什么问题。

  Architectures

  X86 或 OpenPower(POWER8)

Ubuntu14.04下Neo4j图数据库官网安装部署步骤

  第一步:检查上面System Requirement,安装JDK 8,并卸载ubuntu里自带的openjdk。

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:~# java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.8-jre-headless
* openjdk--jre-headless
* gcj-4.6-jre-headless
* openjdk--jre-headless
Try: apt-get install <selected package>
root@zhouls-virtual-machine:~# sudo apt-get remove openjdk*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'openjdk-7-tests' for regex 'openjdk*'
Note, selecting 'openjdk-jre' for regex 'openjdk*'
Note, selecting 'openjdk-6-jre-lib' for regex 'openjdk*'
Note, selecting 'openjdk-7' for regex 'openjdk*'
Note, selecting 'openjdk-6-jdk' for regex 'openjdk*'
Note, selecting 'openjdk-7-jre-zero' for regex 'openjdk*'
Note, selecting 'openjdk-6-source' for regex 'openjdk*'
Note, selecting 'openjdk-6-jre-headless' for regex 'openjdk*'
Note, selecting 'openjdk-6-dbg' for regex 'openjdk*'
Note, selecting 'openjdk-7-jdk' for regex 'openjdk*'
Note, selecting 'openjdk-7-jre-headless' for regex 'openjdk*'
Note, selecting 'openjdk-6-jre' for regex 'openjdk*'
Note, selecting 'openjdk-7-dbg' for regex 'openjdk*'
Note, selecting 'openjdk-7-jre-lib' for regex 'openjdk*'
Note, selecting 'uwsgi-plugin-jvm-openjdk-6' for regex 'openjdk*'
Note, selecting 'uwsgi-plugin-jvm-openjdk-7' for regex 'openjdk*'
Note, selecting 'openjdk-6-doc' for regex 'openjdk*'
Note, selecting 'openjdk-7-jre' for regex 'openjdk*'
Note, selecting 'openjdk-7-source' for regex 'openjdk*'
Note, selecting 'openjdk-6-jre-zero' for regex 'openjdk*'
Note, selecting 'openjdk-7-demo' for regex 'openjdk*'
Note, selecting 'openjdk-7-doc' for regex 'openjdk*'
Note, selecting 'openjdk-6-demo' for regex 'openjdk*'
Note, selecting 'uwsgi-plugin-jwsgi-openjdk-6' for regex 'openjdk*'
Note, selecting 'uwsgi-plugin-jwsgi-openjdk-7' for regex 'openjdk*'
Package 'openjdk-7' is not installed, so not removed
Package 'openjdk-jre' is not installed, so not removed
Package 'uwsgi-plugin-jvm-openjdk-6' is not installed, so not removed
Package 'uwsgi-plugin-jvm-openjdk-7' is not installed, so not removed
Package 'uwsgi-plugin-jwsgi-openjdk-6' is not installed, so not removed
Package 'uwsgi-plugin-jwsgi-openjdk-7' is not installed, so not removed
Package 'openjdk-7-dbg' is not installed, so not removed
Package 'openjdk-7-demo' is not installed, so not removed
Package 'openjdk-7-doc' is not installed, so not removed
Package 'openjdk-7-jdk' is not installed, so not removed
Package 'openjdk-7-jre' is not installed, so not removed
Package 'openjdk-7-jre-headless' is not installed, so not removed
Package 'openjdk-7-source' is not installed, so not removed
Package 'openjdk-7-tests' is not installed, so not removed
Package 'openjdk-6-dbg' is not installed, so not removed
Package 'openjdk-6-demo' is not installed, so not removed
Package 'openjdk-6-doc' is not installed, so not removed
Package 'openjdk-6-jdk' is not installed, so not removed
Package 'openjdk-6-jre' is not installed, so not removed
Package 'openjdk-6-jre-headless' is not installed, so not removed
Package 'openjdk-6-jre-lib' is not installed, so not removed
Package 'openjdk-6-jre-zero' is not installed, so not removed
Package 'openjdk-6-source' is not installed, so not removed
Package 'openjdk-7-jre-lib' is not installed, so not removed
Package 'openjdk-7-jre-zero' is not installed, so not removed
upgraded, newly installed, to remove and not upgraded.
root@zhouls-virtual-machine:~#

下载 Java

  Java 8 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

  

  我暂时,传到/home/zhouls/Downloads下

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

  我将 java 放在目录/usr/local/目录下,路径和命令为:

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local# ls
bin etc games include lib man sbin share src
root@zhouls-virtual-machine:/usr/local# mkdir app
root@zhouls-virtual-machine:/usr/local# cd app/
root@zhouls-virtual-machine:/usr/local/app# pwd
/usr/local/app
root@zhouls-virtual-machine:/usr/local/app# ls
root@zhouls-virtual-machine:/usr/local/app# cp /home/zhouls/Downloads/jdk-8u60-linux-x64.tar.gz .
root@zhouls-virtual-machine:/usr/local/app# ls
jdk-8u60-linux-x64.tar.gz
root@zhouls-virtual-machine:/usr/local/app#

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app# ls
jdk-8u60-linux-x64.tar.gz
root@zhouls-virtual-machine:/usr/local/app# tar -zxvf jdk-8u60-linux-x64.tar.gz

  

 为了,兼容去其余的版本,我这里使用软连接。

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app# ls
jdk1..0_60 jdk-8u60-linux-x64.tar.gz
root@zhouls-virtual-machine:/usr/local/app# rm jdk-8u60-linux-x64.tar.gz
root@zhouls-virtual-machine:/usr/local/app# ll
total
drwxr-xr-x root root 6月 : ./
drwxr-xr-x root root 6月 : ../
drwxr-xr-x uucp 8月 jdk1..0_60/
root@zhouls-virtual-machine:/usr/local/app# ln -s jdk1..0_60/ jdk
root@zhouls-virtual-machine:/usr/local/app# ll
total
drwxr-xr-x root root 6月 : ./
drwxr-xr-x root root 6月 : ../
lrwxrwxrwx root root 6月 : jdk -> jdk1..0_60//
drwxr-xr-x uucp 8月 jdk1..0_60/
root@zhouls-virtual-machine:/usr/local/app# chown -R root:root jdk1..0_60/
root@zhouls-virtual-machine:/usr/local/app# ll
total
drwxr-xr-x root root 6月 : ./
drwxr-xr-x root root 6月 : ../
lrwxrwxrwx root root 6月 : jdk -> jdk1..0_60//
drwxr-xr-x root root 8月 jdk1..0_60/
root@zhouls-virtual-machine:/usr/local/app#

 

 至于为什么这样来做,请移步

大数据各子项目的环境搭建之建立与删除软连接(博主推荐)

编辑/etc/profile文件,添加下面配置信息,然后执行source /etc/profile命令使之生效。

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app# vim /etc/profile

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

#java
export JAVA_HOME=/usr/local/app/jdk
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app# vim /etc/profile
root@zhouls-virtual-machine:/usr/local/app# source /etc/profile
root@zhouls-virtual-machine:/usr/local/app# java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) -Bit Server VM (build 25.60-b23, mixed mode)
root@zhouls-virtual-machine:/usr/local/app#

  下载Neo4j 3.1的安装包

  去官方网址注册下载即可。选择特定的版本。下载地址 https://neo4j.com/download/

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

  选择“Download Communit Edtion”社区版

   在“Other OS Download”中选择 Linux 版(因为,我一般喜欢用tar.gz方式来安装,当然,大家也可以用其他方式来安装)

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

  它会自动下载到你的本地。

https://neo4j.com/artifact.php?name=neo4j-community-3.2.0-unix.tar.gz

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app# ls
jdk jdk1..0_60
root@zhouls-virtual-machine:/usr/local/app# cp /home/zhouls/Downloads/neo4j-community-3.2.-unix.tar.gz .
root@zhouls-virtual-machine:/usr/local/app# ls
jdk jdk1..0_60 neo4j-community-3.2.-unix.tar.gz
root@zhouls-virtual-machine:/usr/local/app#

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app# ls
jdk jdk1..0_60 neo4j-community-3.2.-unix.tar.gz
root@zhouls-virtual-machine:/usr/local/app# tar -zxvf neo4j-community-3.2.-unix.tar.gz

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app# ls
jdk jdk1..0_60 neo4j-community-3.2. neo4j-community-3.2.-unix.tar.gz
root@zhouls-virtual-machine:/usr/local/app# rm neo4j-community-3.2.-unix.tar.gz
root@zhouls-virtual-machine:/usr/local/app# ll
total
drwxr-xr-x root root Jun : ./
drwxr-xr-x root root Jun : ../
lrwxrwxrwx root root Jun : jdk -> jdk1..0_60//
drwxr-xr-x root root Aug jdk1..0_60/
drwxr-xr-x lightdm nogroup May : neo4j-community-3.2./
root@zhouls-virtual-machine:/usr/local/app# chown -R root:root neo4j-community-3.2./
root@zhouls-virtual-machine:/usr/local/app# ln -s neo4j-community-3.2./ neo4j
root@zhouls-virtual-machine:/usr/local/app# ll
total
drwxr-xr-x root root Jun : ./
drwxr-xr-x root root Jun : ../
lrwxrwxrwx root root Jun : jdk -> jdk1..0_60//
drwxr-xr-x root root Aug jdk1..0_60/
lrwxrwxrwx root root Jun : neo4j -> neo4j-community-3.2.//
drwxr-xr-x root root May : neo4j-community-3.2./
root@zhouls-virtual-machine:/usr/local/app#

  配置neo4j的环境变量

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app# vim /etc/profile

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

#neo4j
export NEO4J_HOME=/usr/local/app/neo4j
export PATH=$PATH:$NEO4J_HOME/bin

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app# vim /etc/profile
root@zhouls-virtual-machine:/usr/local/app# source /etc/profile
root@zhouls-virtual-machine:/usr/local/app#

neo4j的配置文件(图文详解)

  修改conf/neo4j.conf配置文件,将dbms.connectors.default_listen_address=0.0.0.0注释字符去掉

  如果不设置Neo4j的配置文件,只能从本机访问Neo4J的web控制台(http://localhost:7474/) Neo4j的控制文件一般位于<neo4jhome>/conf/neo4j.conf,例如我测试环境为/usr/local/app/neo4j/conf

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

修改前:#dbms.connectors.default_listen_address=0.0.0.0

修改后: dbms.connectors.default_listen_address=0.0.0.0

启动 Neo4j

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app/neo4j/conf# neo4j start
Active database: graph.db
Directories in use:
home: /usr/local/app/neo4j
config: /usr/local/app/neo4j/conf
logs: /usr/local/app/neo4j/logs
plugins: /usr/local/app/neo4j/plugins
import: /usr/local/app/neo4j/import
data: /usr/local/app/neo4j/data
certificates: /usr/local/app/neo4j/certificates
run: /usr/local/app/neo4j/run
Starting Neo4j.
WARNING: Max open files allowed, minimum of recommended. See the Neo4j manual.
Started neo4j (pid ). It is available at http://0.0.0.0:7474/
There may be a short delay until the server is ready.
See /usr/local/app/neo4j/logs/neo4j.log for current status.
root@zhouls-virtual-machine:/usr/local/app/neo4j/conf# neo4j status
Neo4j is running at pid
root@zhouls-virtual-machine:/usr/local/app/neo4j/conf#

  此时一切正常。

  或者

bin/neo4j console 

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:/usr/local/app/neo4j# ls
bin conf import LICENSES.txt logs plugins run
certificates data lib LICENSE.txt NOTICE.txt README.txt UPGRADE.txt
root@zhouls-virtual-machine:/usr/local/app/neo4j# bin/neo4j console
Active database: graph.db
Directories in use:
home: /usr/local/app/neo4j
config: /usr/local/app/neo4j/conf
logs: /usr/local/app/neo4j/logs
plugins: /usr/local/app/neo4j/plugins
import: /usr/local/app/neo4j/import
data: /usr/local/app/neo4j/data
certificates: /usr/local/app/neo4j/certificates
run: /usr/local/app/neo4j/run
Starting Neo4j.
WARNING: Max open files allowed, minimum of recommended. See the Neo4j manual.
-- ::20.269+ INFO ======== Neo4j 3.2. ========
-- ::22.614+ INFO Starting...
-- ::27.000+ INFO Bolt enabled on 0.0.0.0:.
-- ::50.131+ INFO Started.
-- ::57.150+ INFO Remote interface available at http://localhost:7474/

打开neo4j的 Web 端

根据启动时的提示,在浏览器中打开:http://localhost:7474/

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

  第一次登陆会提示你输入初始化密码并提醒你修改密码。默认的密码为neo4j. 如果允许远程访问,切记修改初始化密码。安全非常重要。

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

  

  默认值都是neo4j
  更改新密码为123456。

  即我的用户名是neo4j,密码是123456。

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

  

可以点击页面上的“Start Learning”进行初步的学习 Neo4j。

至此,Neo4j 已经在 Ubuntu 上安装好了。

上一篇:poj 1269 水题


下一篇:Ubuntu16.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)