APT fails to install elasticsearch 2.x

Hello, I have trouble installing Elasticsearch v2.x on ubuntu 18.04. Here's the output I get with the simplest case:

vik@ubuntu:~$ curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
OK
vik@ubuntu:~$ cat /etc/apt/sources.list.d/elastic-2.x.list
deb https://artifacts.elastic.co/packages/2.x/apt stable main
vik@ubuntu:~$ sudo apt update
Hit:1 http://ua.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://ua.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://ua.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://ua.archive.ubuntu.com/ubuntu bionic-security InRelease
Ign:5 https://artifacts.elastic.co/packages/2.x/apt stable InRelease
Err:6 https://artifacts.elastic.co/packages/2.x/apt stable Release
  404  Not Found [IP: 34.120.127.130 443]
Reading package lists... Done
E: The repository 'https://artifacts.elastic.co/packages/2.x/apt stable Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
vik@ubuntu:~$

Making apt source file trusted makes it follow through, but then I encounter the following error:

vik@ubuntu:~$ cat /etc/apt/sources.list.d/elastic-2.x.list
deb [trusted=yes] https://artifacts.elastic.co/packages/2.x/apt stable main
vik@ubuntu:~$ sudo apt update
Hit:1 http://ua.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://ua.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://ua.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://ua.archive.ubuntu.com/ubuntu bionic-security InRelease
Ign:5 https://artifacts.elastic.co/packages/2.x/apt stable InRelease
Ign:6 https://artifacts.elastic.co/packages/2.x/apt stable Release
Ign:7 https://artifacts.elastic.co/packages/2.x/apt stable/main all Packages
Ign:8 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 Packages
Ign:9 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en_US
Ign:10 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en
Ign:11 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 c-n-f Metadata
Ign:12 https://artifacts.elastic.co/packages/2.x/apt stable/main all c-n-f Metadata
Ign:7 https://artifacts.elastic.co/packages/2.x/apt stable/main all Packages
Ign:8 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 Packages
Ign:9 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en_US
Ign:10 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en
Ign:11 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 c-n-f Metadata
Ign:12 https://artifacts.elastic.co/packages/2.x/apt stable/main all c-n-f Metadata
Ign:7 https://artifacts.elastic.co/packages/2.x/apt stable/main all Packages
Ign:8 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 Packages
Ign:9 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en_US
Ign:10 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en
Ign:11 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 c-n-f Metadata
Ign:12 https://artifacts.elastic.co/packages/2.x/apt stable/main all c-n-f Metadata
Ign:7 https://artifacts.elastic.co/packages/2.x/apt stable/main all Packages
Ign:8 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 Packages
Ign:9 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en_US
Ign:10 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en
Ign:11 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 c-n-f Metadata
Ign:12 https://artifacts.elastic.co/packages/2.x/apt stable/main all c-n-f Metadata
Ign:7 https://artifacts.elastic.co/packages/2.x/apt stable/main all Packages
Ign:8 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 Packages
Ign:9 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en_US
Ign:10 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en
Ign:11 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 c-n-f Metadata
Ign:12 https://artifacts.elastic.co/packages/2.x/apt stable/main all c-n-f Metadata
Ign:7 https://artifacts.elastic.co/packages/2.x/apt stable/main all Packages
Ign:8 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 Packages
Ign:9 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en_US
Ign:10 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en
Ign:11 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 c-n-f Metadata
Ign:12 https://artifacts.elastic.co/packages/2.x/apt stable/main all c-n-f Metadata
Ign:7 https://artifacts.elastic.co/packages/2.x/apt stable/main all Packages
Err:8 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 Packages
  404  Not Found [IP: 34.120.127.130 443]
Ign:9 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en_US
Ign:10 https://artifacts.elastic.co/packages/2.x/apt stable/main Translation-en
Ign:11 https://artifacts.elastic.co/packages/2.x/apt stable/main amd64 c-n-f Metadata
Ign:12 https://artifacts.elastic.co/packages/2.x/apt stable/main all c-n-f Metadata
Reading package lists... Done
E: Failed to fetch https://artifacts.elastic.co/packages/2.x/apt/dists/stable/main/binary-amd64/Packages  404  Not Found [IP: 34.120.127.130 443]
E: Some index files failed to download. They have been ignored, or old ones used instead.

In this example, I edit elastic-2.x.list by hand, which is quite undesirable, since my automation should be handling that for me (chef).

What is causing this? Why should I add [trusted=yes] for 2.x, but it works fine for 5.x?
Upgrading to something newer is my last resort. I would rather not do it now if possible.

Thank you

2.x is not supported anymore and should not be installed.
Same for 5.x.
6.8 should be avoided as 8.0 will be released soon and 6.8 will be EOL.

Instead use 7.17.0

1 Like

I understand that it is old, but the project I'm working on uses that older version. Currently, we are migrating to ubuntu (hence issues with apt), and I would rather upgrade elasticsearch later down the road than right now and all at once.

Since both 2.x and 5.x are EOL, why is that 2.x is not working but 5.x still does? Is there a possibility that there are issues on elastics side apt repositories?

Here is the documentation for 2.4: Repositories | Elasticsearch Guide [2.4] | Elastic

Not sure this would help you though.

I have no idea TBH.

1 Like

Ok, silly me. I falsely assumed that repo address is the same across versions. Looking at Elasticsearch docs for v2.4, the repo URL is different than it is for newer versions :man_facepalming:.

Thanks for your help. Cheers.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.