1. 程式人生 > 其它 >Linux使用 RPM 安裝 Elasticsearch

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