2024年运维最全linux系统安装elasticsearch教程_linux 安装es
以下是一个基本的Linux系统安装Elasticsearch的步骤概览,请根据您的具体Linux发行版进行调整:
- 更新系统包索引(Debian/Ubuntu):
sudo apt-get update
- 安装Elasticsearch的公钥(Debian/Ubuntu):
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
- 添加Elasticsearch的APT源(Debian/Ubuntu):
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
- 更新系统包索引(CentOS/RHEL):
sudo yum update
- 添加Elasticsearch的YUM源(CentOS/RHEL):
cat << EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF
- 安装Elasticsearch:
# Debian/Ubuntu
sudo apt-get install elasticsearch
# CentOS/RHEL
sudo yum install elasticsearch
- 启动Elasticsearch服务:
sudo systemctl start elasticsearch
- 设置Elasticsearch开机自启:
sudo systemctl enable elasticsearch
- 验证Elasticsearch是否正在运行:
curl -X GET "localhost:9200/"
请注意,这些命令假定您正在使用的是基于Debian的系统(如Ubuntu)或基于RPM的系统(如CentOS或Red Hat Enterprise Linux)。对于其他Linux发行版,可能需要调整APT或YUM的配置步骤。此外,Elasticsearch有一些配置要求,包括内存和权限设置,确保在生产环境中按照Elasticsearch的官方文档进行设置。
评论已关闭