CentOS 8.5に Elasticsearchをインストールする

2021年12月22日

環境
OSバージョンの確認
# cat /etc/redhat-release
CentOS Linux release 8.5.2111
javaバージョンの確認
# java –version
openjdk 16.0.1 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode, sharing)

インストールの方法
1.Elasticsearchリポジトリをインストールします

# sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

2.リポジトリを編集します
# sudo vi /etc/yum.repos.d/elasticsearch.repo
下記の内容を追記します

[elasticsearch-7.x]
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=1
autorefresh=1
type=rpm-md

3.Elasticsearchをインストールします

# sudo dnf install elasticsearch

4.Elasticsearchの自動起動と起動を設定します

# sudo systemctl enable elasticsearch.service --now
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.

5.動作確認
# curl -X GET “127.0.0.1:9200/"

# curl -X GET "127.0.0.1:9200/"
{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "TtsEopEXRY67WUuS9XkrhA",
  "version" : {
    "number" : "7.16.2",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "2b937c44140b6559905130a8650c64dbd0879cfb",
    "build_date" : "2021-12-18T19:42:46.604893745Z",
    "build_snapshot" : false,
    "lucene_version" : "8.10.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

6.ファイアウォールを設定します

# firewall-cmd --add-port=9200/tcp --zone=public --permanent
success
# firewall-cmd --reload
success

 

CentOS8

Posted by arkgame