I followed the instructions here:
https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
To capture the output uninstalled the .deb I installed manually and ran through the commands again. This might be slightly different output than the very first time I did this because the .deb was previously installed but it illustrates the point:
So step 1. I installed the key
ivan@rowlf:~$ wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
OK
ivan@rowlf:~$
Step 2 Save the repository definition to /etc/apt/sources.list.d/elasticsearch-2.x.list:
ivan@rowlf:~$ echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
deb http://packages.elastic.co/elasticsearch/2.x/debian stable main
ivan@rowlf:~$ cat /etc/apt/sources.list.d/elasticsearch-2.x.list
deb http://packages.elastic.co/elasticsearch/2.x/debian stable main
ivan@rowlf:~$
Step 3: install the package
ivan@rowlf:~$ sudo apt-get update && sudo apt-get install elasticsearch
Hit http://packages.elastic.co stable Release.gpg
Hit http://packages.elastic.co stable Release.gpg
Hit http://packages.elastic.co stable Release.gpg
Hit http://packages.elastic.co stable Release
Hit http://packages.elastic.co stable Release
Hit http://packages.elastic.co stable Release
Hit http://packages.elastic.co stable/main i386 Packages
Hit http://packages.elastic.co stable/main i386 Packages
Hit http://packages.elastic.co stable/main i386 Packages
Ign http://packages.elastic.co stable/main Translation-en_GB
Ign http://packages.elastic.co stable/main Translation-en
Ign http://packages.elastic.co stable/main Translation-en_GB
Ign http://packages.elastic.co stable/main Translation-en
Ign http://packages.elastic.co stable/main Translation-en_GB
Ign http://packages.elastic.co stable/main Translation-en
Fetched 159 kB in 8s (19.8 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package elasticsearch is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'elasticsearch' has no installation candidate
ivan@rowlf:~$
After this I just downloaded the .deb directly from the site and installed it
ivan@rowlf:~$ wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.3.2/elasticsearch-2.3.2.deb
ivan@rowlf:~$ sudo dpkg -i elasticsearch-2.3.2.deb
Selecting previously unselected package elasticsearch.
(Reading database ... 80130 files and directories currently installed.)
Unpacking elasticsearch (from elasticsearch-2.3.2.deb) ...
Setting up elasticsearch (2.3.2) ...
ivan@rowlf:~$ sudo cp elasticsearch-2.3.2.deb /var/cache/apt/archives/
Then I did this just to make sure there were no unresolved dependencies:
ivan@rowlf:~$ sudo apt-get update -f
The result is that elasticsearch is installed in /usr/share/elasticsearch
But logstash and kibana which installed successfully from apt-get are in /opt