Can't install Elastic on CentOS 8

Hello - I installed Elastic for trying it out in a simple local server. Based on the instructions here:

My /etc/elasticsearch/elasticsearch.yml file is as follows:

node.name: "My First Node"
cluster.name: clusteruzi
node.roles: [ master ]

http.port: 9200
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch

transport.host: localhost
transport.tcp.port: 9300

network.host: 10.0.0.5

[label /etc/elasticsearch/elasticsearch.yml]
script.allowed_types: none

When I start elasticsearch with this config, the service fails.

This is the log I found in my /etc/log/elasticsearch/gc.log.16 (the log files are added with a suffix..)

[2024-03-31T20:11:24.452+0000][1070755][gc] Using G1
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Version: 15+36 (release)
[2024-03-31T20:11:24.462+0000][1070755][gc,init] CPUs: 4 total, 4 available
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Memory: 7768M
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Large Page Support: Disabled
[2024-03-31T20:11:24.462+0000][1070755][gc,init] NUMA Support: Disabled
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Compressed Oops: Enabled (32-bit)
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Heap Region Size: 1M
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Heap Min Capacity: 1G
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Heap Initial Capacity: 1G
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Heap Max Capacity: 1G
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Pre-touch: Disabled
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Parallel Workers: 4
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Concurrent Workers: 1
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Concurrent Refinement Workers: 4
[2024-03-31T20:11:24.462+0000][1070755][gc,init] Periodic GC: Disabled
[2024-03-31T20:11:24.462+0000][1070755][gc,metaspace] CDS disabled.
[2024-03-31T20:11:24.462+0000][1070755][gc,metaspace] Compressed class space mapped at: 0x0000000100000000-0x0000000140000000, size: 1073741824
[2024-03-31T20:11:24.462+0000][1070755][gc,metaspace] Narrow klass base: 0x0000000000000000, Narrow klass shift: 3, Narrow klass range: 0x140000000
[2024-03-31T20:11:24.547+0000][1070755][gc,heap,exit] Heap
[2024-03-31T20:11:24.547+0000][1070755][gc,heap,exit]  garbage-first heap   total 1048576K, used 1024K [0x00000000c0000000, 0x0000000100000000)
[2024-03-31T20:11:24.547+0000][1070755][gc,heap,exit]   region size 1024K, 2 young (2048K), 0 survivors (0K)
[2024-03-31T20:11:24.547+0000][1070755][gc,heap,exit]  Metaspace       used 3306K, capacity 4480K, committed 4480K, reserved 1056768K
[2024-03-31T20:11:24.547+0000][1070755][gc,heap,exit]   class space    used 266K, capacity 384K, committed 384K, reserved 1048576K

Hi @JuliePrist Welcome to the community!

I would highly recommend following our documentation.

That documentation you're following is nearly 4 years old and does not really apply to the 8.x

Of note 8.x will automatically configure security and the certificates etc.

I would uninstall what you did , clean out everything and start over following our documentation.

Then come back with some questions.

In addition to Stephen's comments I would also recommend removing this setting. If you are setting up a single-node cluster it should have all roles.

You may also want o look at the support matrix to see which OS versions are supported for which versions of Elasticsearch.

Thank you. So I uninstalled the old elastic, and installed it using the official instructions (or tried to), which are meant for very geeky folks.

The step after RPM install, of nodes--

When you install Elasticsearch, the installation process configures a single-node cluster by default. If you want a node to join an existing cluster instead, generate an enrollment token on an existing node before you start the new node for the first time.

What nodes, what clusters? All I have done at this point is install the RPM. How about guiding me prescriptively with a single node first?

"On any node in your existing cluster, generate a node enrollment token:"

How do I know what my cluster is?

Anyway, when I initiate that node command:

/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node

This is the error I see:

Exception in thread "main" org.elasticsearch.common.settings.SettingsException: Failed to load settings from [elasticsearch.yml]
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1249)
	at org.elasticsearch.node.InternalSettingsPreparer.loadConfigWithSubstitutions(InternalSettingsPreparer.java:126)
	at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:52)
	at org.elasticsearch.common.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:110)
	at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:85)
	at org.elasticsearch.cli.Command.main(Command.java:50)
	at org.elasticsearch.launcher.CliToolLauncher.main(CliToolLauncher.java:64)
Caused by: org.elasticsearch.xcontent.XContentParseException: [2:25] while scanning for the next token
found character '\t(TAB)' that cannot start any token. (Do not use \t(TAB) for indentation)
 in 'reader', line 3, column 1:
    	#node.roles: [ master ]
    ^

 at [Source: (ByteArrayInputStream); line: 2, column: 25]
	at org.elasticsearch.xcontent.provider.json.JsonXContentParser.newXContentParseException(JsonXContentParser.java:52)
	at org.elasticsearch.xcontent.provider.json.JsonXContentParser.nextFieldName(JsonXContentParser.java:71)
	at org.elasticsearch.common.settings.Settings.fromXContent(Settings.java:768)
	at org.elasticsearch.common.settings.Settings.fromXContent(Settings.java:736)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1245)
	... 7 more
Caused by: com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAMLException: while scanning for the next token
found character '\t(TAB)' that cannot start any token. (Do not use \t(TAB) for indentation)
 in 'reader', line 3, column 1:
    	#node.roles: [ master ]
    ^

 at [Source: (ByteArrayInputStream); line: 2, column: 25]
	at com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAMLException.from(MarkedYAMLException.java:28)
	at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:433)
	at com.fasterxml.jackson.core.JsonParser.nextFieldName(JsonParser.java:1091)
	at org.elasticsearch.xcontent.provider.json.JsonXContentParser.nextFieldName(JsonXContentParser.java:69)
	... 10 more
Caused by: while scanning for the next token
found character '\t(TAB)' that cannot start any token. (Do not use \t(TAB) for indentation)
 in 'reader', line 3, column 1:
    	#node.roles: [ master ]
    ^

	at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:445)
	at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:238)
	at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:639)
	at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:162)
	at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:172)
	at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:429)
	... 12 more

What now?

The instructions on the official site say nothing about the elasticsearch.yml config at all, but I manually changed it to similar lines as above, but kept it simple with fewer instructions:

node.name: "My First Node"
cluster.name: clusteruzi
http.port: 9200
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 10.0.0.5

What next ?

Hi @JuliePrist

So let's back up a bit...

What are you trying to accomplish... I get trying to install Elasticsearch...

Is this just for fun?

Are you learning/ testing to use for work?

Centos 8 is not supported for 8.x our newest releases... Is that the only OS you have access to?

What version are you trying to install?

7.x vs 8.x are substantially different.

Are you familiar with Docker (Podman) that might be easier depending on your goals.

Are you trying to create a multi-node cluster? (Probably not a great idea for first try)

You can create a free trial on elastic cloud.

cloud.elastic.co

That's because you do not need to edit anything, just get the basic up and running..

Looks like you added tabs in your .yml which is not valid.

And then we could help with a couple minor settings.

What version did you install?

I want to install on CentOS 8 Stream. That's what runs on my server. I want to try Elastic, so one node, one cluster - the most basic stuff is OK.

No, installing based on the official instructions did NOT work. Starting the service without changing YML file had the exact same errors.

I want to install on CentOS. How can that highly prevalent OS server not be supported?

Hi @JuliePrist

Exactly which version did you install?

This is Elasticsearch 7.17.19

Why Elasticsearch 8.x is not Supported on Centos 8?... I will need to check, I am sure there is a reason. (You can, of course, always use Docker.)

Here are my complete direct steps to install elasticseearch 7.17.19 and getit running on centOS 8 with all the defaults.

This is a brand new centOS 8 VM.

This is following the docs here....

Note that there is no editing of any .yml files, and the last command shows running.

See if you can get there and perhaps we can move to the next step.

Using the defaults elasticsearch is bound to localhost and is not available via the network... this is by design as a security measure. We can fix that later.

[sbrown@stephenbrown-centos-8 ~]$ uname -a
Linux stephenbrown-centos-8 4.18.0-544.el8.x86_64 #1 SMP Thu Feb 22 21:29:23 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

[sbrown@stephenbrown-centos-8 ~]$ sudo yum install wget

[sbrown@stephenbrown-centos-8 ~]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.19-x86_64.rpm
--2024-04-01 01:45:03--  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.19-x86_64.rpm
Resolving artifacts.elastic.co (artifacts.elastic.co)... 34.120.127.130, 2600:1901:0:1d7::
Connecting to artifacts.elastic.co (artifacts.elastic.co)|34.120.127.130|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 325616721 (311M) [binary/octet-stream]
Saving to: ā€˜elasticsearch-7.17.19-x86_64.rpmā€™

elasticsearch-7.17.19-x86_64.rpm    100%[================================================================>] 310.53M  20.5MB/s    in 15s     

2024-04-01 01:45:18 (20.8 MB/s) - ā€˜elasticsearch-7.17.19-x86_64.rpmā€™ saved [325616721/325616721]

[sbrown@stephenbrown-centos-8 ~]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.19-x86_64.rpm.sha512
--2024-04-01 01:45:25--  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.19-x86_64.rpm.sha512
Resolving artifacts.elastic.co (artifacts.elastic.co)... 34.120.127.130, 2600:1901:0:1d7::
Connecting to artifacts.elastic.co (artifacts.elastic.co)|34.120.127.130|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 163 [binary/octet-stream]
Saving to: ā€˜elasticsearch-7.17.19-x86_64.rpm.sha512ā€™

elasticsearch-7.17.19-x86_64.rpm.sh 100%[================================================================>]     163  --.-KB/s    in 0s      

2024-04-01 01:45:25 (5.93 MB/s) - ā€˜elasticsearch-7.17.19-x86_64.rpm.sha512ā€™ saved [163/163]

[sbrown@stephenbrown-centos-8 ~]$ sha512sum -c elasticsearch-7.17.19-x86_64.rpm.sha512 
elasticsearch-7.17.19-x86_64.rpm: OK

[sbrown@stephenbrown-centos-8 ~]$ sudo systemctl daemon-reload

[sbrown@stephenbrown-centos-8 ~]$ sudo systemctl enable elasticsearch.service
Synchronizing state of elasticsearch.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable elasticsearch
Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service ā†’ /usr/lib/systemd/system/elasticsearch.service.

[sbrown@stephenbrown-centos-8 ~]$ sudo systemctl start elasticsearch

[sbrown@stephenbrown-centos-8 ~]$ sudo systemctl status elasticsearch
ā— elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2024-04-01 01:50:01 UTC; 8s ago
     Docs: https://www.elastic.co
 Main PID: 71414 (java)
    Tasks: 71 (limit: 23184)
   Memory: 2.2G
   CGroup: /system.slice/elasticsearch.service
           ā”œā”€71414 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.tt>
           ā””ā”€71603 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

Apr 01 01:49:34 stephenbrown-centos-8 systemd[1]: Starting Elasticsearch...
Apr 01 01:49:38 stephenbrown-centos-8 systemd-entrypoint[71414]: Apr 01, 2024 1:49:38 AM sun.util.locale.provider.LocaleProviderAdapter <cli>
Apr 01 01:49:38 stephenbrown-centos-8 systemd-entrypoint[71414]: WARNING: COMPAT locale provider will be removed in a future release
Apr 01 01:50:01 stephenbrown-centos-8 systemd[1]: Started Elasticsearch.

[sbrown@stephenbrown-centos-8 ~]$ curl http://localhost:9200
{
  "name" : "stephenbrown-centos-8",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "3AD-RXgiTKCa5VPZZS0xRA",
  "version" : {
    "number" : "7.17.19",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "92f290e9537478f85ff3fe3ab39945c1a49a6c1a",
    "build_date" : "2024-03-21T14:34:38.216751500Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.3",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
[sbrown@stephenbrown-centos-8 ~]$ 

If you get that running and you want to put elasticsearch on the network securely you can follow a HowTo I wrote here...

1 Like

In case that is a bit hard to read above because I put in the output as well, here are just the commands

[sbrown@stephenbrown-centos-8 ~]$ sudo yum install wget
[sbrown@stephenbrown-centos-8 ~]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.19-x86_64.rpm
[sbrown@stephenbrown-centos-8 ~]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.19-x86_64.rpm.sha512
[sbrown@stephenbrown-centos-8 ~]$ sha512sum -c elasticsearch-7.17.19-x86_64.rpm.sha512 
[sbrown@stephenbrown-centos-8 ~]$ sudo systemctl daemon-reload
[sbrown@stephenbrown-centos-8 ~]$ sudo systemctl enable elasticsearch.service
[sbrown@stephenbrown-centos-8 ~]$ sudo systemctl start elasticsearch
[sbrown@stephenbrown-centos-8 ~]$ sudo systemctl status elasticsearch
[sbrown@stephenbrown-centos-8 ~]$ curl http://localhost:9200
1 Like

Is there some installation step missing?


[root@sub ~]# sudo systemctl daemon-reload

[root@sub ~]# sudo systemctl enable elasticsearch.service
Failed to enable unit: Unit file elasticsearch.service does not exist.

[root@sub ~]# sudo systemctl start elasticsearch
Failed to start elasticsearch.service: Unit elasticsearch.service not found.

[root@sub ~]# sudo systemctl status elasticsearch
ā— elasticsearch.service
   Loaded: not-found (Reason: Unit elasticsearch.service not found.)
   Active: failed (Result: exit-code) since Sun 2024-03-31 18:36:32 EDT; 13h ago
 Main PID: 1074532 (code=exited, status=1/FAILURE)

Mar 31 18:36:32 sub.domain.com systemd-entrypoint[1074532]:         at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.>
Mar 31 18:36:32 sub.domain.com systemd-entrypoint[1074532]:         at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:>
Mar 31 18:36:32 sub.domain.com systemd-entrypoint[1074532]:         at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(P>
Mar 31 18:36:32 sub.domain.com systemd-entrypoint[1074532]:         at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:162)
Mar 31 18:36:32 sub.domain.com systemd-entrypoint[1074532]:         at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:172)
Mar 31 18:36:32 sub.domain.com systemd-entrypoint[1074532]:         at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLPars>
Mar 31 18:36:32 sub.domain.com systemd-entrypoint[1074532]:         ... 12 more
Mar 31 18:36:32 sub.domain.com systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Mar 31 18:36:32 sub.domain.com systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Mar 31 18:36:32 sub.domain.com systemd[1]: Failed to start Elasticsearch.

It looks like that the package was not installed?

Did you run sudo yum install ./package-file.rpm ?

1 Like

Phew, that was it ... I just religiously followed your command sequence, missing the rpm install :slight_smile:

1 Like

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