ElasticSearch CentOS7安装教程

1、下载安装包(不推荐直接用最新版,出了问题难搜到解决方案的博客,目前已经更新到7.x版本,我查一些博客的时候看到大家基本在用5.x 6.x)

因此我为了稳,还是选择了5.x

下载

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.16.tar.gz

解压并进入目录

tar -zxvf elasticsearch-5.6.16.tar.gz
cd elasticsearch-5.6.16

下面ElasticSearch简称为ES

ES需要JAVA的支持,如果没有下载则

yum install java-1.8.0-openjdk.x86_64 -y

2、ES从5.x后出于安全性考虑,不允许直接使用Root用户启动,必须自己创建一个用户用来启动

adduser elasticsearch
passwd elasticsearch
#然后输入两次密码(可以不管提示里的什么密码过短啥的,直接输入两遍)
#然后将对刚才下载的目录赋予权限给elasticsearch
chown -R elasticsearch  /download/elasticsearch-5.6.16

3、切换到刚才的用户并启动ES

cd /download/elasticsearch-5.6.16
sh bin/elasticsearch
#一旦关闭这个终端就会被关闭
#如果要持久一直在后台运行就用下面这个命令,将运行时的输出存入到run_log.txt
#nohup sh bin/elasticsearch >run_log.txt 2>&1 &

 

image.png

4、检查确认是否安装成功

curl http://localhost:9200/?pretty

结果

 

image.png

安装成功!

posted @ 2020-07-11 02:17  HumorChen99  阅读(0)  评论(0编辑  收藏  举报  来源