From 66e47cf4d01cc819a4bd379563ffb8ef42adcea5 Mon Sep 17 00:00:00 2001 From: Mark Tyers Date: Tue, 13 Aug 2019 13:32:51 +0100 Subject: [PATCH] added chapter on services --- Managing Services.md | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/Managing Services.md b/Managing Services.md index 4eba7d2..16c65d2 100644 --- a/Managing Services.md +++ b/Managing Services.md @@ -9,7 +9,45 @@ https://www.linuxjournal.com/content/initializing-and-managing-services-linux-pa ### 1.1 Installing Neo4J -In this section you will be shown how to install and run a Neo4J instance using SystemV. +In this section you will be shown how to install and run a Neo4J instance using SystemV. The database requires Java and all packages will be installed and managed by the apt package manager. + +```shell +$ sudo apt install default-jre default-jre-headless +$ java --version +$ wget --no-check-certificate -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add - +$ echo 'deb http://debian.neo4j.org/repo stable/' | sudo tee /etc/apt/sources.list.d/neo4j.list +$ sudo apt update +$ sudo apt install -y neo4j +$ sudo service neo4j status + ● neo4j.service - Neo4j Graph Database + Loaded: loaded (/lib/systemd/system/neo4j.service; disabled; vendor preset: enabled) + Active: active (running) since Wed 2019-08-07 13:05:12 BST; 22min ago + Main PID: 1283 (java) + Tasks: 53 (limit: 2200) + Memory: 194.5M + CGroup: /system.slice/neo4j.service +$ sudo service neo4j start +$ cypher-shell -u neo4j -p neo4j +``` + +The last command launches the cli tools which provides a shell where we can execute cypher queries. the command `:exit` quits the shell and returns you to the bash prompt. The following commands are executed in this shell. The first changes the password for the default account and the second retrieves all the nodes from the graph (currrently none). Note that each query needs to terminate with a semicolon. + +``` +neo4j> CALL dbms.changePassword('newPassword'); +neo4j> CREATE (n:USER {name:"Test User"}) RETURN n; +neo4j> MATCH (users) RETURN users; + +-----------------------------+ + | users | + +-----------------------------+ + | (:USER {name: "Test User"}) | + +-----------------------------+ + 1 row available after 187 ms, consumed after another 2 ms +neo4j> MATCH (n) DETACH DELETE n; + 0 rows available after 262 ms, consumed after another 0 ms + Deleted 1 nodes +neo4j> :exit + Bye! +``` ## 2 Docker