注:本文章的ubuntu的版本为:ubuntu-20.04.6-live-server-amd64。
Ubuntu(在线版)
更新软件源
sudo apt-get update
添加Neo4j官方存储库
wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -
将地址添加到系统的软件包源列表中
echo 'deb https://debian.neo4j.com stable latest' | sudo tee -a /etc/apt/sources.list.d/neo4j.list
更新软件源
sudo apt-get update
安装 Neo4j
注:本文章安装neo4j 5.18.1
sudo apt install neo4j=1:5.18.1
启动Neo4j
sudo neo4j start
出现以下信息即启动成功
Directories in use:
home: /var/lib/neo4j
config: /etc/neo4j
logs: /var/log/neo4j
plugins: /var/lib/neo4j/plugins
import: /var/lib/neo4j/import
data: /var/lib/neo4j/data
certificates: /var/lib/neo4j/certificates
licenses: /var/lib/neo4j/licenses
run: /var/lib/neo4j/run
Starting Neo4j.
Started neo4j (pid:13261). It is available at http://localhost:7474
There may be a short delay until the server is ready.
Ubuntu(离线版)
进入下载链接选择Neo4j版本下载
https://neo4j.com/deployment-center/
注:本文章下载neo4j-community-5.18.1-unix.tar.gz
解压文件到指定目录
tar -xvf neo4j-community-5.18.1-unix.tar.gz -C /usr/local
进入解压后的目录
cd /usr/local/neo4j-community-5.18.1/
启动neo4j
bin/neo4j start
可能报错:Error: JAVA_HOME is not defined correctly. We cannot execute
报错原因是缺少jdk或者没有配置全局变量JAVA_HOME,安装或配置即可。
建议安装java 17。
出现以下信息即启动成功
irectories in use:
home: /usr/local/neo4j-community-5.18.1
config: /usr/local/neo4j-community-5.18.1/conf
logs: /usr/local/neo4j-community-5.18.1/logs
plugins: /usr/local/neo4j-community-5.18.1/plugins
import: /usr/local/neo4j-community-5.18.1/import
data: /usr/local/neo4j-community-5.18.1/data
certificates: /usr/local/neo4j-community-5.18.1/certificates
licenses: /usr/local/neo4j-community-5.18.1/licenses
run: /usr/local/neo4j-community-5.18.1/run
Starting Neo4j.
Started neo4j (pid:6588). It is available at http://localhost:7474
There may be a short delay until the server is ready
设置远程连接
修改Neo4j配置文件
# 在线版
sudo vim /etc/neo4j/neo4j.conf
# 离线版
sudo vim /usr/local/neo4j-community-5.18.1/conf/neo4j.conf
把 server.default_listen_address=0.0.0.0 注释放开,重启服务即可。
Neo4j初始化
打开浏览器,输入网址localhost:7474
默认用户名neo4j和密码neo4j
登录后需要修改密码,密码长度需要超过8个字符
修改密码成功
测试Neo4j
show databases; # 展示数据库
正常运行则成功。