# Unable to install elasticsearch on ubuntu

**URL:** <https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-monitoring\
**Created:** [March 30, 2025, 9:02pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565 "2025-03-30T21:02:24Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![remoteconn-7891](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remoteconn-7891/32/141152_2.png) [@remoteconn-7891](https://discuss.elastic.co/u/remoteconn-7891)\
**Post date:** [March 30, 2025, 9:02pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/1 "2025-03-30T21:02:24Z")

</div>

Hello, I'm back. So I'm on Ubuntu Desktop now and trying to install Elasticsearch on the local terminal.

The problem, I get an error that says it can't find the package. Here is the error message I get

```auto
(venv) corey-james@corey-james-HP-Laptop-14-dq0xxx:~/Arborhub/MyProject$ sudo apt install elasticsearch
Error: Unable to locate package elasticsearch

```

Please let me know if you need additional information. Thank you

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [March 30, 2025, 9:09pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/2 "2025-03-30T21:09:57Z")

</div>

Hello,

Did you follow the instructions in the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html)?

You need to add Elastic repository first.

---

<div class="post-metadata">

**Author:** ![remoteconn-7891](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remoteconn-7891/32/141152_2.png) [@remoteconn-7891](https://discuss.elastic.co/u/remoteconn-7891)\
**Post date:** [March 30, 2025, 9:36pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/3 "2025-03-30T21:36:17Z")

</div>

Thank you. Yes I was following the docs and when I tried start Elasticsearch with `sudo systemctl start elasticsearch.service` this is the output I got

```auto
(venv) corey-james@corey-james-HP-Laptop-14-dq0xxx:~/Arborhub/MyProject$ sudo systemctl start elasticsearch.service

```

I think the server started successfully, but since there was no output, I wanted to make sure

---

<div class="post-metadata">

**Author:** ![remoteconn-7891](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remoteconn-7891/32/141152_2.png) [@remoteconn-7891](https://discuss.elastic.co/u/remoteconn-7891)\
**Post date:** [March 30, 2025, 10:12pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/4 "2025-03-30T22:12:26Z")

</div>

I ran this command as per the docs to verify elasticsearch is running `curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200 ` and got this output

```auto
stemctl start kibana.service
(venv) corey-james@corey-james-HP-Laptop-14-dq0xxx:~/Arborhub/MyProject$ curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200 
curl: (77) error setting certificate file: /etc/elasticsearch/certs/http_ca.crt

```

---

<div class="post-metadata">

**Author:** ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)\
**Post date:** [March 30, 2025, 10:20pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/5 "2025-03-30T22:20:08Z")

</div>

Hi Corey

> [@remoteconn-7891](#):
>
> I think the server started successfully

Optimistic! Nothing wrong with optimism.

There was no output pasted, just the command itself, but if the `sudo apt install elasticsearch` failed and you didn't address that, then it's not working.

Can I suggest you go back to step one, and cut and paste every single command and its output. I also note your prompt starts with "(venv)" suggesting you setup some kind of python virtual environment. Thats typically fine, should not impact installing elasticsearch/kibana, but if you are inexperienced linux user it's possible your environment is a little messed up.

Try this too:

`$ apt list --installed | grep elasticsearch` or `$ apt list elasticsearch `

Output will contain something like this if Elasticsearch is properly installed:

```auto
elasticsearch/now 8.17.3 amd64 [installed,local]

```

---

<div class="post-metadata">

**Author:** ![remoteconn-7891](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remoteconn-7891/32/141152_2.png) [@remoteconn-7891](https://discuss.elastic.co/u/remoteconn-7891)\
**Post date:** [March 30, 2025, 10:24pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/6 "2025-03-30T22:24:11Z")

</div>

```auto
(venv) corey-james@corey-james-HP-Laptop-14-dq0xxx:~/Arborhub/MyProject$ apt list --installed | grep elasticsearch

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

elasticsearch/stable,now 8.17.4 amd64 [installed]

```

I can also paste from the terminal, from the beginning of the elasticsearch installation command if you'd like

---

<div class="post-metadata">

**Author:** ![remoteconn-7891](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remoteconn-7891/32/141152_2.png) [@remoteconn-7891](https://discuss.elastic.co/u/remoteconn-7891)\
**Post date:** [March 30, 2025, 10:24pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/7 "2025-03-30T22:24:52Z")

</div>

Yeah I doubt Python virtual environment would have any kind of effect on elasticsearch.

I didn't have an existing node, so the last command I wrote in the docs was  
`sudo systemctl start elasticsearch.service`.

---

<div class="post-metadata">

**Author:** ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)\
**Post date:** [March 30, 2025, 10:32pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/8 "2025-03-30T22:32:26Z")

</div>

that is much better. Now try your curl command with sudo as

```auto
sudo ls -l /etc/elasticsearch/certs/http_ca.crt
-rw-rw---- 1 root elasticsearch 1915 Feb 20 00:44 /etc/elasticsearch/certs/http_ca.crt

```

unless your local user is in the elasticsearch group, that file would not be readable as a normal user.

should see something like:

```auto
$ sudo curl --cacert /etc/elasticsearch/certs/http_ca.crt -u "${EUSER}:${EPASS}" https://localhost:9200
{
  "name" : "u2024",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "xxxxx",
  "version" : {
    "number" : "8.17.3",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "a091390de485bd4b127884f7e565c0cad59b10d2",
    "build_date" : "2025-02-28T10:07:26.089129809Z",
    "build_snapshot" : false,
    "lucene_version" : "9.12.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

```

btw equivalent but not needing sudo is probably

`$ curl -k -u "${EUSER}:${EPASS}" https://localhost:9200`

---

<div class="post-metadata">

**Author:** ![remoteconn-7891](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remoteconn-7891/32/141152_2.png) [@remoteconn-7891](https://discuss.elastic.co/u/remoteconn-7891)\
**Post date:** [March 30, 2025, 11:27pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/9 "2025-03-30T23:27:27Z")

</div>

```auto
(venv) corey-james@corey-james-HP-Laptop-14-dq0xxx:~/Arborhub/MyProject$ sudo ls -l /etc/elasticsearch/certs/http_ca.crt
-rw-rw---- 1 root elasticsearch 1915 Feb 20 00:44 /etc/elasticsearch/certs/http_ca.crt
[sudo] password for corey-james: 
-rw-rw---- 1 root elasticsearch 1915 Mar 30 15:28 /etc/elasticsearch/certs/http_ca.crt
-rw-rw----: command not found

```

---

<div class="post-metadata">

**Author:** ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)\
**Post date:** [March 30, 2025, 11:34pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/10 "2025-03-30T23:34:58Z")

</div>

something very weird about that output ... you pasted both the command and _my_ output into your terminal. Anyways, it was what I said, the file `/etc/elasticsearch/certs/http_ca.crt` is only readable by the elasticsearch user and those in the elasticsearch group, which probably does not include the (local) linux user `corey-james`

put a sudo before your curl command and it should work.

---

<div class="post-metadata">

**Author:** ![remoteconn-7891](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remoteconn-7891/32/141152_2.png) [@remoteconn-7891](https://discuss.elastic.co/u/remoteconn-7891)\
**Post date:** [March 30, 2025, 11:39pm UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/11 "2025-03-30T23:39:14Z")

</div>

I due apologize, like this?

```auto
(venv) corey-james@corey-james-HP-Laptop-14-dq0xxx:~/Arborhub/MyProject$ sudo ls -l /etc/elasticsearch/certs/http_ca.crt
-rw-rw---- 1 root elasticsearch 1915 Mar 30 15:28 /etc/elasticsearch/certs/http_ca.crt

```

---

<div class="post-metadata">

**Author:** ![remoteconn-7891](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remoteconn-7891/32/141152_2.png) [@remoteconn-7891](https://discuss.elastic.co/u/remoteconn-7891)\
**Post date:** [March 31, 2025, 5:20am UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/12 "2025-03-31T05:20:03Z")

</div>

So I don't elasticsearch is running, as it doesn't work with `curl`

---

<div class="post-metadata">

**Author:** ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)\
**Post date:** [March 31, 2025, 5:47am UTC](https://discuss.elastic.co/t/unable-to-install-elasticsearch-on-ubuntu/376565/13 "2025-03-31T05:47:06Z")

</div>

> [@RainTown](#):
>
> put a sudo before your curl command

I can’t really make that suggestion any simpler.

Do you understand why you got the previous error:

> [@remoteconn-7891](#):
>
> `curl: (77) error setting certificate file: /etc/elasticsearch/certs/http_ca.crt`

?

It's because you, meaning user= corey-jame, do not have permissions to read the file. So you need run the curl commands with sudo. Or just use the other option, with -k, which doesn’t need sudo and doesn’t need the —cacert option.

These are very basic Linux/shell topics, not really anything directly to do with elasticsearch. Sorry, but you are likely going to need to get much more familiar with Linux/shell topics to get too much further.
