centos7离线安装neo4j

一、准备需要的rpm包

本地环境执行如下命令:

docker pull couchbase/centos7-systemd
docker run -it couchbase/centos7-systemd bash
# 可能需要换源
yum update -y
vi /etc/yum.conf # 修改其中的keepcache=1
rpm --import https://debian.neo4j.com/neotechnology.gpg.key
cat <<EOF>  /etc/yum.repos.d/neo4j.repo
[neo4j]
name=Neo4j RPM Repository
baseurl=https://yum.neo4j.com/stable
enabled=1
gpgcheck=1
EOF
yum install -y neo4j
mkdir rpms
cp /var/cache/yum/x86_64/7/*/packages/*.rpm rpms/
tar -cJf rpms.tar.xz rpms

新开一个命令行窗口,执行如下命令:

docker cp <container-id>:/root/rpms.tar.xz .
scp rpms.tar.xz root@<server-host>:~/

登陆服务器后,执行如下命令:

tar xf rpms.tar.xz
cd rpms
python3 -c '
from pathlib import Path
fs=list(Path().rglob("*.rpm"))
import os
sudo="" if Path.home().name=="root" else "sudo "
cmd=sudo+"rpm -ivh "
install_all = lambda:sum(os.system(cmd+str(i))==0 for i in fs)
total=len(fs)
for _ in range(total):
    success=install_all()
    if success==total:
        break
'
neo4j status
neo4j --version

你可能感兴趣的:(linux)