Centos7 安装Elasticsearch

Linux系统
446
0
0
2022-11-08

一. 使用RPM方式安装

1. 下载并安装公共签名密钥

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

2. 在/etc/yum.repos.d/下创建elasticsearch.repo 并写入以下内容

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

3. yum 安装

$ sudo yum install --enablerepo=elasticsearch elasticsearch

4. 设置自动启动

$ sudo /bin/systemctl daemon-reload
$ sudo /bin/systemctl enable elasticsearch.service

5. Elasticsearch 相关命令

$ sudo systemctl start elasticsearch.service
$ sudo systemctl stop elasticsearch.service
$ sudo systemctl status elasticsearch.service