Elasticsearch packages are provided by Elasticsearch B.V.. Elasticsearch is a Java application, so you'll have to install a Java Runtime Environment prior to installing Elasticsearch binaries for things to work.
# yum install --assumeyes java-1.8.0-openjdk
# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
# cat >> /etc/yum.repos.d/elasticsearch.repo <<EOF [elasticsearch-6.x] name=Elasticsearch repository for 6.x packages baseurl=https://artifacts.elastic.co/packages/6.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md EOF
# yum install --assumeyes elasticsearch ##### snipped ============================================================================ Package Arch Version Repository Size ============================================================================ Installing: elasticsearch noarch 6.4.0-1 elasticsearch-6.x 93 M Transaction Summary ============================================================================ Install 1 Package ##### snipped
Even though yum supposedly resolve and install package dependencies, elasticsearch might not list java as a dependency thus you might come to this error if you don't manually install java as in the previous step.
Running transaction which: no java in (/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin) could not find java; set JAVA_HOME or ensure java is in PATH error: %pre(elasticsearch-0:6.4.0-1.noarch) scriptlet failed, exit status 1 Error in PREIN scriptlet in rpm package elasticsearch-6.4.0-1.noarch Verifying : elasticsearch-6.4.0-1.noarch 1/1 Failed: elasticsearch.noarch 0:6.4.0-1
network.host: 0.0.0.0
# firewall-cmd --permanent --add-port=9200/tcp success # firewall-cmd --permanent --add-port=9300/tcp success
# firewall-cmd --reload success
# systemctl enable elasticsearch Created symlink from /etc/systemd/system/multi-user.target.wants/elasticsearch.service to /usr/lib/systemd/system/elasticsearch.service.
# systemctl start elasticsearch
The service will take a while to start
$ curl 127.0.0.1:9200 { "name" : "CbbCFrX", "cluster_name" : "elasticsearch", "cluster_uuid" : "IfiakkGkTXy20Xncr_ZZXw", "version" : { "number" : "6.4.0", "build_flavor" : "default", "build_type" : "rpm", "build_hash" : "595516e", "build_date" : "2018-08-17T23:18:47.308994Z", "build_snapshot" : false, "lucene_version" : "7.4.0", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" }
You will not be able to connect immediately to Elasticsearch because the service takes quite a while to start and will get the following error if you try to connect immediately.
curl 127.0.0.1:9200 curl: (7) Failed to connect to 127.0.0.1 port 9200: Connection refused
Comment anonymously. Login not required.