Ubuntu手动安装Elasticsearch详细教程
# 1. 更新包索引
sudo apt-get update
# 2. 安装OpenJDK
sudo apt-get install openjdk-11-jdk
# 3. 验证Java安装
java -version
# 4. 创建Elasticsearch用户
sudo adduser elasticsearch
# 5. 添加Elasticsearch PPA
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
# 6. 导入Elasticsearch公钥
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
# 7. 再次更新包索引
sudo apt-get update
# 8. 安装Elasticsearch
sudo apt-get install elasticsearch
# 9. 配置Elasticsearch
sudo nano /etc/elasticsearch/elasticsearch.yml
# 在配置文件中设置集群名称和节点名称
# cluster.name: my-cluster
# node.name: node-1
# 10. 启动Elasticsearch服务
sudo systemctl start elasticsearch.service
# 11. 设置Elasticsearch开机自启
sudo systemctl enable elasticsearch.service
# 12. 验证Elasticsearch是否运行
curl -X GET "localhost:9200/"
以上脚本提供了在Ubuntu系统上手动安装Elasticsearch的详细步骤。这包括更新包索引、安装OpenJDK、添加Elasticsearch用户、添加Elasticsearch PPA、导入公钥、安装Elasticsearch、编辑配置文件、启动服务以及设置开机自启。最后,使用curl
命令验证Elasticsearch是否成功运行。
评论已关闭