在RedHat或CentOS上安装Elasticsearch
在Red Hat或CentOS上安装Elasticsearch,可以遵循以下步骤:
- 导入Elasticsearch公钥:
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
- 创建Elasticsearch的yum仓库文件:
echo "[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" | sudo tee /etc/yum.repos.d/elasticsearch.repo
- 安装Elasticsearch:
sudo yum install --enablerepo=elasticsearch elasticsearch
- 启动并设置Elasticsearch开机自启:
sudo systemctl start elasticsearch.service
sudo systemctl enable elasticsearch.service
- 验证安装是否成功:
curl -X GET "localhost:9200/"
以上步骤安装的是Elasticsearch 7.x版本,如果需要安装其他版本,请修改仓库文件中的版本号。
评论已关闭