- 安装JDK
yum install -y java-1.8.0-openjdk
- 下载安装公钥
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
- 配置yum源
vim /etc/yum.repos.d/elasticsearch.repo
,s
触发编辑,复制如下内容:
[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
按键ESC
退出编辑,:wq
保存退出。
-
yum makecache
更新缓存 - 执行下载安装
yum install elasticsearch
- 设置支持公网访问,
vim /etc/elasticsearch/elasticsearch.yml
,设置network.host: 0.0.0.0
. - 启动服务
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service