Linux使用 RPM 安装 Elasticsearch
参考网站:https://www.elastic.co/guide/en/elasticsearch/reference/8.5/rpm.html#rpm-repo
1.导入Elasticsearch GPG签名密钥
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
2.创建软件源
cat > /etc/yum.repos.d/elasticsearch.repo << EOF [elasticsearch] name=Elasticsearch repository for 8.x packages baseurl=https://artifacts.elastic.co/packages/8.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md EOF
3.安装
1.使用上面的软件源进行安装
yum install --enablerepo=elasticsearch elasticsearch
2.离线RPM包安装【离线环境】
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.5.2-x86_64.rpm rpm --install elasticsearch-8.5.2-x86_64.rpm
4.配置开机自启
systemctl daemon-reload
systemctl enable elasticsearch.service
5.查看运行是否正常
curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200
安装过程提示:
Creating elasticsearch group... OK Creating elasticsearch user... OK 安装 : elasticsearch-8.5.2-1.x86_64 1/1 运行脚本: elasticsearch-8.5.2-1.x86_64 1/1 warning: ignoring JAVA_HOME=/usr/java/jdk8u352-b08; using bundled JDK warning: ignoring JAVA_HOME=/usr/java/jdk8u352-b08; using bundled JDK --------------------------- Security autoconfiguration information ------------------------------ Authentication and authorization are enabled. TLS for the transport and HTTP layers is enabled and configured. The generated password for the elastic built-in superuser is : 9sjk2gycpTPJugiUUHii If this node should join an existing cluster, you can reconfigure this with '/usr/share/elasticsearch/bin/elasticsearch-reconfigure-node --enrollment-token <token-here>' after creating an enrollment token on your existing cluster. You can complete the following actions at any time: Reset the password of the elastic built-in superuser with '/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic'. Generate an enrollment token for Kibana instances with '/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana'. Generate an enrollment token for Elasticsearch nodes with '/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node'. ------------------------------------------------------------------------------------------------- ### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd sudo systemctl daemon-reload sudo systemctl enable elasticsearch.service ### You can start elasticsearch service by executing sudo systemctl start elasticsearch.service warning: ignoring JAVA_HOME=/usr/java/jdk8u352-b08; using bundled JDK warning: ignoring JAVA_HOME=/usr/java/jdk8u352-b08; using bundled JDK [/usr/lib/tmpfiles.d/elasticsearch.conf:1] Line references path below legacy directory /var/run/, updating /var/run/elasticsearch → /run/elasticsearch; please update the tmpfiles.d/ drop-in file accordingly. 验证 : elasticsearch-8.5.2-1.x86_64 1/1 已安装: elasticsearch-8.5.2-1.x86_64
6.配置外网访问
vi /etc/elasticsearch/elasticsearch.yml
cluster.name: my-application node.name: node-1 path.data: /var/lib/elasticsearch path.logs: /var/log/elasticsearch network.host: 127.0.0.1 http.host: 0.0.0.0 http.port: 9200 http.cors.enabled: true http.cors.allow-origin: "*" discovery.seed_hosts: ["127.0.0.1","[::1]"] cluster.initial_master_nodes: ["node-1"] #以前有的配置有则修改剩下的不要动
7.配置防火墙
firewall-cmd --zone=public --add-port=9300/tcp --permanent firewall-cmd --zone=public --add-port=9200/tcp --permanent systemctl restart firewalld.service
8.访问 https://ip:9200/【注意是https】
账号: elastic
密码:安装过程中提示的那个密码
作者:奇
出处:https://www.cnblogs.com/fanqisoft/p/16949774.html
版权:本作品采用「本文版权归作者和博客园共有,欢迎转载,但必须给出原文链接,并保留此段声明,否则保留追究法律责任的权利。」许可协议进行许可。
分类:
Linux
如果文章内容对您有所帮助,欢迎赞赏.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!