一、先安装jdk8,查看https://juejin.cn/post/6844904003378085895
二、ES的yum安装配置
由于ES不在yum的本地源,所以我们需要添加ES的yum配置。1、下载并安装ES的yum公钥
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch2、配置ES的yum源
# vim /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命令模式输入:wq保存
三、yum安装ES
1、更新yum的缓存# yum makecache2、安装ES
# yum -y install elasticsearch3、修改配置文件
a.打开/etc/elasticsearch/elasticsearch.yml
cluster.name: 自定义集群名称(强烈推荐默认名称elasticsearch)
node.name: 自定义节点名称es01
network.host:把后面改为0.0.0.0,这样访问可以通过访问本机的ip来访问
http.port: 启动的es对外访问的http端口,默认9200
b. 打开 /etc/sysconfig/elasticsearch,修改java_home,因为es7.x安装包中带有jdk。配置包中路径。
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64
4、常用命令
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl start elasticsearch.service
systemctl stop elasticsearch.service