Neo4j安装
【2022年6月7日09:26:56】
按照惯例先放官方手册:Installation - Operations Manual (neo4j.com)
主要流程:
- 确定Neo4j版本:
- server or desktop?社区版 or 企业版?
- 新旧版本(建议最新版)
- 下载与操作系统对应的安装包
- 安装JDK
- JDK8 or JDK11
- 下载安装
- 配置环境变量
- 测试
- 安装Neo4j
- 安装
- 配置环境变量
- 启动,修改密码
版本简介
主要分为社区版和企业版
社区版,免费,功能有限;
根据应用形式的不同,又可分为browser版和desktop版;
桌面版是一个集成的客户端,捆绑了Java JDK 11和8版本,以及最新版本的Bloom、Browser和Neo4j Enterprise Edition。适合新手学习,安装方便,下载安装包后运行,根据提示完成安装即可。
Once Neo4j Desktop is launched, you will need to provide an activation key in order to activate your copy of Desktop. Copy and paste the key, which can be found on top of the download page, into the box in the Desktop app. Alternatively, you can generate a new key from the Desktop app by completing the form on the right hand side of the screen.
一旦 Neo4j 桌面启动,您将需要提供一个激活密钥,以激活您的桌面副本。复制并粘贴键,可以在下载页面的顶部找到,到桌面应用程序的框中。或者,你也可以通过填写屏幕右侧的表单,从 Desktop 应用程序生成一个新的密钥。
Browser版,安装配置好服务后,可通过浏览器进行可视化界面访问,适用于生产环境,进行软件的开发和部署。
Server版安装
因为自己常用windows和ubuntu,就以这两个系统为例。
版本:Neo4j-社区版-4.x
JDK安装
无论那个系统,都要首先有对应的java环境。
neo4j-4.x和jdk11匹配.
neo4j-3.x需要jdk8.
安装好后cmd输入java -version
检查是否安装好。
Windows
Windows installation - Operations Manual (neo4j.com)
-
下载安装
从 Neo4j 下载中心下载最新版本。Neo4j Download Center - Neo4j Graph Data Platform
下载好后解压到自己想放的盘里,并解压,例如:E:\Program Files (x86)\neo4j-community-4.4.7
Neo4j应用程序有如下主要的目录结构:
- bin目录:用于存储Neo4j的可执行程序;
- conf目录:用于控制Neo4j启动的配置文件;
- data目录:用于存储核心数据库文件;
- plugins目录:用于存储Neo4j的插件;
-
配置系统环境变量
-
其实安装完已经可以在<neo4j_home>\bin下用
neo4j console
命令启动neo4j:PS E:\Program Files (x86)\neo4j-community-4.4.7\bin> neo4j console
但是这样只能在bin路径运行命令,不够方便,配置系统环境变量后可以在任意路径下运行neo4j命令。
-
在计算机-属性中创建系统环境变量
NEO4J_HOME
,并把主目录(E:\Program Files (x86)\neo4j-community-4.4.7)设置为变量值。NEO4J_HOME=E:\Program Files (x86)\neo4j-community-3.4.0
-
再在
path
中添加%NEO4J_HOME%\bin
。完成配置。
-
3.启动
- 打开终端,运行
neo4j console
D:\>neo4j console
2020-09-04 00:57:31.092+0000 INFO Starting...
2020-09-04 00:57:33.899+0000 INFO ======== Neo4j 4.1.1 ========
2020-09-04 00:57:35.689+0000 INFO Performing postInitialization step for component 'security-users' with version 2 and status CURRENT
2020-09-04 00:57:35.690+0000 INFO Updating the initial password in component 'security-users'
2020-09-04 00:57:36.120+0000 INFO Bolt enabled on localhost:7687.2020-09-04 00:57:37.572+0000 INFO Remote interface available at http://localhost:7474/
2020-09-04 00:57:37.573+0000 INFO Started.
2020-09-04 00:58:27.864+0000 WARN The client is unauthorized due to authentication failure.
2020-09-04 00:58:28.545+0000 WARN The client is unauthorized due to authentication failure.
-
启动后在浏览器中键入http://localhost:7474/,进入登录界面。
-
输入初始用户名和密码(均为
neo4j
),成功连接后会让我们修改密码,然后就可以开始使用了。
4.停止
在启动neo4j的终端用快捷键crtl+c可停止,或者运行neo4j stop
命令。
Ubuntu
我的系统是ubuntu-18.04,用tar包的方式安装neo4j-community-4.4.7。
Linux tarball installation - Operations Manual (neo4j.com)
- Download the latest release from Neo4j Download Center.
从 Neo4j 下载中心下载最新版本。
Select the appropriate tar.gz distribution for your platform.
为您的平台选择适当的 tar.gz 发行版。
- Check that the SHA hash of the downloaded file is correct:
检查下载文件的 SHA 散列是否正确:
To find the correct SHA hash, go to Neo4j Download Center and click on
SHA-256
which will be located below your downloaded file.要找到正确的 SHA 散列,请转到 Neo4j 下载中心并单击 SHA-256,它将位于下载文件的下方。
Using the appropriate commands for your platform, display the
SHA-256
hash for the file that you downloaded.为您的平台使用适当的命令,显示您下载的文件的 SHA-256散列。
Ensure that the two are identical.
确保两者完全相同。
Extract the contents of the archive, using
tar -xf <filename>
使用 tar-xf < filename > 提取归档文件的内容
Refer to the top-level extracted directory as: NEO4J_HOME
请将顶级解压缩目录称为: NEO4J _ HOME
- Change directory to:
$NEO4J_HOME
将目录更改为: $NEO4J _ HOME
Run
./bin/neo4j console
运行./bin/neo4j 控制台
- Stop the server by typing
Ctrl-C
in the console.通过在控制台中键入 Ctrl-C 来停止服务器。