生产环境
系统:ubuntu 16.04 LTS
安装版本:Neo4j 3.1.3
安装
编写sh脚本
#!/bin/bash
# This script installs default Java Machine and latest version of enterprise Neo4j on your machine
# This script is compatible with Debian(8+) and Ubuntu (14.04+) as on Dec-21-2016
# update your distro
sudo apt-get update
# install the default JRE (required for running Neo4j)
sudo apt-get install default-jre -y
# the following commands add the neo4j repo to apt-get
wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
echo 'deb https://debian.neo4j.org/repo stable/' | sudo tee /etc/apt/sources.list.d/neo4j.list
# get packages from the Neo4j list. I know it's been run before, but I like to
# do this twice just to ensure nothing got left out earlier
sudo apt-get update
# Gets Neo4j enterprise. To get latest version use sudo apt-get install neo4j-enterprise
# sudo apt-get install neo4j-enterprise=x.x.x, e.g. sudo apt-get install neo4j-enterprise=3.1.0
sudo apt-get install neo4j-enterprise=3.1.3 -y
# Install vim
sudo apt-get install vim -y
echo "in case of 3.1.3, the conf file can be edited by running vim /etc/neo4j/neo4j.conf"
保存为install.sh之后给予运行权限就好了
而后使用命令neo4j console
就可以开启neo4j了,通过访问http://localhost:7474/
可以查看那个超级厉害的控制台(若提示权限不足,请用sudo
)
默认配置信息
可通过vim /etc/neo4j/neo4j.conf
查看
默认的文件目录如下
# Paths of directories in the installation.
dbms.directories.data=/var/lib/neo4j/data #数据库目录
dbms.directories.plugins=/var/lib/neo4j/plugins #插件目录
dbms.directories.certificates=/var/lib/neo4j/certificates
dbms.directories.logs=/var/log/neo4j #日志目录
dbms.directories.lib=/usr/share/neo4j/lib #jar包目录
dbms.directories.run=/var/run/neo4j
dbms.directories.metric=/var/lib/neo4j/metrics
修改数据库目录
因为在后面的操作过程中几乎一定会遇到需要增加、修改数据文件和日志文件的情况,为了避免各种访问权限问题的打扰,我们可以将数据库的目录更改到另一个地方,首先先将默认数据库目录整个复制到新的目录下面,然后修改配置文件
dbms.directories.data=/home/ericwyn/neo4j/data #更改后数据库目录地址
保存后使用命令neo4j restart
重新启动一下neo4j就好了