Join Duane Nickull for an in-depth discussion in this video Installing Neo4j, part of Learning Neo4j.
During this installation of the Neo4j course, we're going to go through the manual steps of downloading and starting it up, and then verifying the startup and after that, we're going to start using Neo4j. To get Neo4j, proceed to the URL, www.neo4j.org. There are a number of great resources on this web site. To start with though, we're going to click the Neo4j download button. The current version at the time of this video is 2.0.1, and it's a community edition for Mac that I'm using.
There's other editions for Linux, and also for PC. Simply click the download button, and this will take you to the download page. The download page is worth reading. First of all, you have to make sure that you have the latest JDK 7 or greater installed. There is a link directly on this page to the Oracle JDK 7. It is important to note that you must have the JDK, which stands for Java Development Kit.
Not just the JRE, which is the Java Runtime Environment. The JDK has extra tools in it, such as the Java Compiler. To get the JDK, follow the link, and this will take you to the Oracle Java development kit download page. There are a number of JDKs available. For Linux, there is both x86 as well as 64 bit downloads. For Mac OS X, there's only one.
This would be the one that I would use for my particular machine. You'll have to accept the licence agreement. And then click on the download. This is in fact for JDK 7. Once the download for Neo4j has stopped, you'll want to go into the folder that it is in. In this case, it's the downloads folder. Neo4j will be packaged as a gzipped tar file. To open it, simply double click on it, or use your extraction toolkit for your operating system of your choice.
Once extracted, the file folder should resemble this. The Neo4j community head folder. A sub folder called bin. One called conf, for configuration. The data sub folder. The documentation sub folder. A set of libraries you can use for embedding Neo4j into your projects. Plugins folder, and the system folder. All folders are augmented with readme text files in case you wish to look further at what is in the folder.
To begin with, we're going to look at the bin folder, or bin folder. On a Mac OS X system, you can simply double click the Neo4j installer, and this will install the software. On a PC, there is a similar file, it's a batch file ending in .bat, which will install for you. I'm not going to do this because I've already installed it, but it is very simple, follow the instructions on the screen and it takes a couple of minutes.
Once you have this installed, you can open up a Terminal. A Terminal can be found on a Mac system by going to Applications, at the very bottom of the list, there is a Utilities folder, and you can start your terminal by double clicking on it. On PC, you would simply use the Start command, and then type in cmd, which would of course open up the terminal window for you.
I'm finding which directory I'm in using the pwd command. They must navigate to the directory that I have installed it in. I have downloaded Neo4j into the downloads folder of my computer and I can simply run it from there. To start with, I'll need to change directories. And the listing of the directory, I have the neo4j-community-2.0.1. And under this, I have the folders bin, conf, data, etc.
Change directories into your bin folder. And under here, you can see number of the shell scripts that are needed to install or use Neo4j. If I were to install Neo4j, from the line command, I would type in neo4j-installer and then the word install. You will also notice that by using the word remove, we can uninstall Neo4j. To check the status of the Neo4j service, to see whether it's running or not, you can type in neo4j.
In fact, just typing it in without any adjectives, we can see a number of commands we can use. We can get the console, we can start, we can use the start-no-wait command, which will start it up immediately, the stop, restart, status, info, and again, the install and remove commands. Before I start it up, I like to check the status. This is simply done by typing the word status after Neo4j.
This tells me the service is not running currently. To start up the server, type in neo4j space start. The server is now ready. To verify, at any time, again, you can use the status command. It tells me the server is running, and the service is process ID 2243. To hit the front end, there is a console, at local host 7474, and that is the port number.
And voila, we are running and live with Neo4j. There is a lot to this administration console, and we'll be covering this in the next chapter.
- What are NoSQL and graphic databases?
- Examining basic graph modeling
- Using Cypher to query Neo4j
- Using paths to traverse multiple nodes
- Getting properties back from paths
- Using specific nodes
- Handling conditions
- Creating entities
- Deleting entities