Fedora使用dnf(yum)简易安装Elasticsearch6

安装JDK8

http://www.oracle.com/technetwork/java/javase/downloads/index.html

下载安装 public signing key

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

添加仓库

1
2
3
4
5
6
7
8
9
10
11
$ sudo vi /etc/yum.repos.d/elasticsearch.repo

# 添加如下
[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

安装

1
$ sudo dnf install Elasticsearch

配置(需要更改存数据储位置或日志存储位置)

1
2
3
4
5
6
7
$ sudo vi /etc/elasticsearch/elasticsearch.yml

# 更改如下
#path.data: /var/lib/elasticsearch
path.data: /home/lib/elasticsearch
#path.logs: /var/log/elasticsearch
path.logs: /home/log/elasticsearch

手动建立/home/lib/elasticsearch和/home/log/elasticsearch路径

更改权限

1
2
$ sudo chown -R elasticsearch:elasticsearch /home/lib/elasticsearch
$ sudo chown -R elasticsearch:elasticsearch /home/log/elasticsearch

运行

1
$ sudo systemctl start elasticsearch