How do you download Neo4j using the shell?

The Neo4j Server Installation documentation has minimal advice:

Download the latest release from http://neo4j.org/download
select the appropriate version for your platform

The website offers this download link for the current stable version of Neo4j on Linux: http://download.neo4j.org/artifact?edition=community&version=1.9.1&distribution=tarball

This works fine in a web browser but not in my shell.

I used wget to fetch the package using that link:

root@turing:/home/iain# wget http://download.neo4j.org/artifact?edition=community&version=1.9.1&distribution=tarball
[1] 14951
[2] 14952
root@turing:/home/iain# --2013-07-04 17:07:12-- http://download.neo4j.org/artifact?edition=community
Resolving download.neo4j.org... 198.101.198.70
Connecting to download.neo4j.org|198.101.198.70|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-07-04 17:07:13 ERROR 404: Not Found.
^C
[1]- Exit 8 wget http://download.neo4j.org/artifact?edition=community
[2]+ Done version=1.9.1

After reporting a 404 error, wget hangs until I kill it with CTRL + C.

A website called Geil Things has a Neo4j wiki article that contains the real download link.

The link is hidden in a shell script. The important line looks like this:

wget http://dist.neo4j.org/neo4j-community-${NEWVERSION}-unix.tar.gz

If you replace ${NEWVERSION} with 1.9.1 you get the link the current stable version of Neo4j.

The complete wget command looks like this:

wget http://dist.neo4j.org/neo4j-community-1.9.1-unix.tar.gz

If you run the command in the shell you should see output like this:

root@turing:/home/iain# wget http://dist.neo4j.org/neo4j-community-1.9.1-unix.tar.gz
--2013-07-04 17:21:52-- http://dist.neo4j.org/neo4j-community-1.9.1-unix.tar.gz
Resolving dist.neo4j.org... 178.236.4.60
Connecting to dist.neo4j.org|178.236.4.60|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 37512748 (36M) [application/x-tar]
Saving to: “neo4j-community-1.9.1-unix.tar.gz”
100%[======================================>] 37,512,748 30.5M/s in 1.2s
2013-07-04 17:21:53 (30.5 MB/s) - “neo4j-community-1.9.1-unix.tar.gz” saved [37512748/37512748]

Now you’ve downloaded the archive. You can continue to follow the installation instructions in the documentation.

3 thoughts on “How do you download Neo4j using the shell?

  1. Pingback: How do you extract an archive using the shell? | Base Table

  2. You just have to quote the neo4j download url correctly otherwise the shell interprets the & as backgrounding

    And wget only gets a partial URL

    Using dist.neo4j.org is not advisable as it can change anytime

    • D’oh! I forgot that the shell interprets ampersands. So what looked like one command to me was to the shell three commands concatenated by ‘&’.

      wget tried to download http://download.neo4j.org/artifact?edition=community, which doesn’t exist. If you visit the URL in a browser you see “Sorry, we couldn’t find that artifact”.

      What happened next?

      The URL query parameter syntax happens to have the same form as the shell’s syntax for setting environment variables.

      After killing the stalled wget, I searched the environment variables by grepping the output of set:

      iain@turing:~$ set | grep ^distribution=
      distribution=tarball

      For some reason, “set | grep ^version=” returns nothing.

      So you can unintentionally set new environment variables if you don’t delimit your download strings.

      Potentially a dangerous mistake to make!

      Thanks for the help, Michael!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s