30

I'm on Ubuntu 16 and I'd like to add a neo4j package. I tried in 3 ways all leading to the same error.

These are my attempts:

wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

sudo wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

sudo -i wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

But I always get this error message:

ERROR: This command can only be used by root.
--2016-11-04  http://debian.neo4j.org/neotechnology.gpg.key
Resolving debian.neo4j.org (debian.neo4j.org)... 52.0.233.188
Connecting to debian.neo4j.org (debian.neo4j.org)|52.0.233.188|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4791 (4,7K) [application/octet-stream]
Saving to: ‘STDOUT’

-                     0%[                    ]       0  --.-KB/s    in 0s      


Cannot write to ‘-’ (Broken pipe).
splunk
  • 403

2 Answers2

50

You need to change your wget command from:

wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

to:

wget -O - http://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
heynnema
  • 73,649
22

The error message is from apt-key, and as it says, use it with sudo:

wget -O - http://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
muru
  • 207,228