[root@sa ~]#rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
创建repo文件
[root@sa ~]#vim /etc/yum.repos.d/elasticsearch.repo[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=https://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
yum安装ES
[root@sa ~]#yum install elasticsearch -y
启动ES
[root@sa ~]#service elasticsearch start
PS:我在运行的时候发生的报错,如下:
which: no java in (/sbin:/usr/sbin:/bin:/usr/bin)
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME
但是我的java配置都是正确的:
[root@sa ~]# java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01,mixed mode)
[root@sa ~]# echo $JAVA_HOME
/usr/java/jdk1.8.0_65
[root@sa ~]# ln -s /usr/java/jdk1.8.0_65/bin/java /usr/bin/java
[root@sa ~]# vim /etc/elasticsearch/elasticsearch.yml
54 network.host: IP地址
访问一下:http://IP地址:9200/
{ "name" : "Geiger","cluster_name" : "elasticsearch","version" : { "number" : "2.3.4","build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f","build_timestamp" : "2016-06-30T11:24:31Z","build_snapshot" : false,"lucene_version" : "5.5.0" },"tagline" : "You Know,for Search" }
默认安装目录为:/usr/share/elasticsearch/
默认配置目录为:/etc/elasticsearch/
ok,搞定!
原文链接:https://www.f2er.com/centos/381586.html