Elasticsearchをインストールする

手順

Install Elasticsearch with RPM

SSHで接続

PS C:\Users\shirokuma> ssh elk@192.168.0.2

rootにsu

[elk@localhost ~]$ su -

GPG-KEYをインポート

[root@localhost ~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

yumリポジトリの追加

[root@localhost ~]# vi /etc/yum.repos.d/elasticsearch.repo

[elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md

elasticsearchのインストール

[root@localhost ~]# yum install --enablerepo=elasticsearch elasticsearch

自動起動の設定

[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl enable elasticsearch.service

起動確認

[root@localhost ~]# systemctl start elasticsearch.service
[root@localhost ~]# systemctl stop elasticsearch.service
[root@localhost ~]# journalctl --unit elasticsearch

Firewallの設定

[root@localhost ~]# firewall-cmd --add-service=elasticsearch --zone=public --permanent
[root@localhost ~]# firewall-cmd --reload

疎通確認

[root@localhost ~]# systemctl start elasticsearch.service
[root@localhost ~]# curl 127.0.0.1:9200