在Ubuntu 20.04 LTS Focal Fossa上安装Elasticsearch
步骤1.首先,通过apt
在终端中运行以下以下命令,确保所有系统软件包都是最新的。
sudo apt update
sudo apt upgrade
步骤2.在Ubuntu 20.04上安装Elasticsearch。
运行以下命令以导入存储库的GPG密钥:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
现在将Elasticsearch存储库添加到系统中:
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
然后,运行apt update,然后在Ubuntu系统上安装Elasticsearch软件包:
sudo apt update
sudo apt install elasticsearch
安装过程完成后,Elasticsearch服务将不会自动启动。要启动服务并启用服务运行,请执行以下操作:
sudo systemctl enable --now elasticsearch.service
要验证Elasticsearch是否正在运行,请使用curl将HTTP请求发送到本地主机上的端口9200:
curl -X GET "localhost:9200/"
您应该看到类似以下内容:
{ "name" : "vagrant", "cluster_name" : "elasticsearch", "cluster_uuid" : "IJqDxPfXSmeilanabRIg", "version" : { "number" : "7.8.0", "build_flavor" : "default", "build_type" : "deb", "build_hash" : "757314695ramona26d1abmw5e65", "build_date" : "2020-07-14T19:38:55.2343Z", "build_snapshot" : false, "lucene_version" : "8.5.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } It may take 5-10 seconds for the service to start. If you see curl: (7) Failed to connect to localhost port 9200: Connection refused, wait for a few seconds and try again.
步骤4.配置Elasticsearch。
我们现在有一个针对Elasticsearch的活动安装。为了有效地使用Elasticsearch,我们可以对配置进行一些重要的更改。运行以下命令以打开ES配置文件:
sudo nano /etc/elasticsearch/elasticsearch.yml
更改以下值:
network.host: 0.0.0.0
重新启动Elasticsearch服务,以使更改生效:
sudo systemctl restart elasticsearch
恭喜你!您已经成功安装了Elasticsearch。感谢您使用本教程在Ubuntu 20.04 LTS Focal Fossa系统上安装Elasticsearch。有关其他帮助或有用信息,我们建议您检查Elasticsearch官方网站。
原创文章,作者:校长,如若转载,请注明出处:https://www.yundongfang.com/Yun43737.html