1. 进入Elasticsearch官网下载指南 https://www.elastic.co/cn/downloads/elasticsearch
2. 根据服务器操作系统下载安装,我的是Ubuntu,所以选择deb
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.0-amd64.deb
# 如果下载速度太慢可以用下面这个
# wget https://www.shequyi.fun/media/elasticsearch
3. 安装
sudo dpkg -i elasticsearch-7.5.0-amd64.deb
4. 修改配置,令Elasticsearch只能本机访问
sudo vi /etc/elasticsearch/elasticsearch.yml
/etc/elasticsearch/elasticsearch.yml excerpt(updated)
network.host: localhost
5. 重启服务并设置开机启动
sudo systemctl enable elasticsearch && sudo systemctl restart elasticsearch
6. 验证安装效果
curl -X GET 'http://localhost:9200'
将看到类似下面的响应
{
"name" : "yi.fun",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "ipUHngjhQq-d2P7RlKInWA",
"version" : {
"number" : "7.5.0",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "e9ccaed468e2fac2275a3761849cbee64b39519f",
"build_date" : "2019-11-26T01:06:52.518245Z",
"build_snapshot" : false,
"lucene_version" : "8.3.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}