Installing elasticsearch with apt-get on debian

Hi there,

Is anyone else having trouble installing elasticsearch on debian using apt-get?

I've set up the repo as described on the site:

https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html

I installed the key

wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

then the repo which you can see:

cat /etc/apt/sources.list.d/elasticsearch-2.x.list
deb http://packages.elastic.co/elasticsearch/2.x/debian stable main

I also set up repos for logstash and kibana as per instructions:

cat /etc/apt/sources.list

deb http://packages.elastic.co/logstash/2.3/debian stable main

cat /etc/apt/sources.list.d/kibana-4.4.x.list
deb http://packages.elastic.co/kibana/4.4/debian stable main

I can install logstash and kibana with apt-get install no problem but when I try to install elasticsearch it can't find the package

logstash and kibana are installed into /opt
If I download the .deb package for elasticsearch then install it with dpkg it puts it in /usr/share. I'd like them all to be done the same way :slight_smile:

uname -a
Linux rowlf 3.2.0-4-686-pae #1 SMP Debian 3.2.78-1 i686 GNU/Linux
cat /etc/debian_version
7.10

Any ideas?

Regards,
Ivan

What command did you use to install ES and what is the output?

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

1 Like

Sounds like there may be another source somewhere interfering.