安装 OpenSearch Dashboards (Debian)
与 Tarball 方法相比,使用 Advanced Packaging Tool (APT) 包管理器安装 OpenSearch Dashboards 极大地简化了流程。例如,包管理器处理了多项技术考虑,如安装路径、配置文件位置以及创建由 systemd
管理的服务。
在安装 OpenSearch Dashboards 之前,您必须配置一个 OpenSearch 集群。请参阅 OpenSearch Debian 安装指南以获取步骤。
本指南假设您熟悉 Linux 命令行界面 (CLI) 的操作。您应该了解如何输入命令、在目录之间导航以及编辑文本文件。某些示例命令引用了 vi
文本编辑器,但您可以使用任何可用的文本编辑器。
从软件包安装 OpenSearch Dashboards
- 直接从 OpenSearch 下载页面下载所需版本的 Debian 软件包。Debian 软件包可用于 x64 和 arm64 架构。
- 从 CLI 中,使用
dpkg
进行安装。# x64 sudo dpkg -i opensearch-dashboards-3.1.0-linux-x64.deb # arm64 sudo dpkg -i opensearch-dashboards-3.1.0-linux-arm64.deb
- 安装完成后,重新加载 systemd 管理器配置。
sudo systemctl daemon-reload
- 启用 OpenSearch 作为服务。
sudo systemctl enable opensearch-dashboards
- 启动 OpenSearch 服务。
sudo systemctl start opensearch-dashboards
- 验证 OpenSearch 是否正确启动。
sudo systemctl status opensearch-dashboards
指纹验证
Debian 软件包未签名。如果您想验证指纹,OpenSearch 项目提供了 .sig
文件和 .deb
软件包,可与 GNU Privacy Guard (GPG) 配合使用。
- 下载所需的 Debian 软件包。
curl -SLO https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/3.1.0/opensearch-dashboards-3.1.0-linux-x64.deb
- 下载相应的签名文件。
curl -SLO https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/3.1.0/opensearch-dashboards-3.1.0-linux-x64.deb.sig
- 下载并导入 GPG 密钥。
curl -o- https://artifacts.opensearch.org/publickeys/opensearch-release.pgp | gpg --import -
- 验证签名。
gpg --verify opensearch-dashboards-3.1.0-linux-x64.deb.sig opensearch-dashboards-3.1.0-linux-x64.deb
从 APT 仓库安装 OpenSearch Dashboards
APT 是基于 Debian 的操作系统的主要包管理工具,它允许您从 APT 仓库下载和安装 Debian 软件包。
- 安装必要的软件包。
sudo apt-get update && sudo apt-get -y install lsb-release ca-certificates curl gnupg2
- 导入公共 GPG 密钥。此密钥用于验证 APT 仓库是否已签名。
curl -o- https://artifacts.opensearch.org/publickeys/opensearch-release.pgp | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-release-keyring
- 为 OpenSearch 创建一个 APT 仓库。
echo "deb [signed-by=/usr/share/keyrings/opensearch-release-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/3.x/apt stable main" | sudo tee /etc/apt/sources.list.d/opensearch-dashboards-3.x.list
- 验证仓库是否成功创建。
sudo apt-get update
- 添加仓库信息后,列出所有可用的 OpenSearch 版本。
sudo apt list -a opensearch-dashboards
- 选择您要安装的 OpenSearch 版本:
- 除非另有说明,否则将安装 OpenSearch 的最新可用版本。
sudo apt-get install opensearch-dashboards
- 要安装特定版本的 OpenSearch Dashboards,请在软件包名称后传递版本号。
# Specify the version manually using opensearch=<version> sudo apt-get install opensearch-dashboards=3.1.0
- 除非另有说明,否则将安装 OpenSearch 的最新可用版本。
- 完成后,启用 OpenSearch。
sudo systemctl enable opensearch-dashboards
- 启动 OpenSearch。
sudo systemctl start opensearch-dashboards
- 验证 OpenSearch 是否正确启动。
sudo systemctl status opensearch-dashboards
探索 OpenSearch Dashboards
默认情况下,OpenSearch Dashboards(与 OpenSearch 一样)在您初次安装时绑定到 localhost
。因此,除非更新配置,否则 OpenSearch Dashboards 无法从远程主机访问。
- 打开
opensearch_dashboards.yml
。sudo vi /etc/opensearch-dashboards/opensearch_dashboards.yml
- 指定 OpenSearch Dashboards 应该绑定的网络接口。
# Use 0.0.0.0 to bind to any available interface. server.host: 0.0.0.0
- 保存并退出。
- 重启 OpenSearch Dashboards 以应用配置更改。
sudo systemctl restart opensearch-dashboards
- 从 Web 浏览器导航到 OpenSearch Dashboards。默认端口是 5601。
- 使用默认用户名
admin
和默认密码admin
登录。(对于 OpenSearch 2.12 及更高版本,密码应为自定义管理员密码) - 访问 OpenSearch Dashboards 入门以了解更多信息。
升级到新版本
使用 dpkg
或 apt-get
安装的 OpenSearch Dashboards 实例可以轻松升级到新版本。
使用 DPKG 手动升级
直接从 OpenSearch 项目下载页面下载所需升级版本的 Debian 软件包。
导航到包含发行版的目录并运行以下命令:
sudo dpkg -i opensearch-dashboards-3.1.0-linux-x64.deb
APT-GET
要使用 apt-get
升级到最新版本的 OpenSearch Dashboards,请运行以下命令:
sudo apt-get upgrade opensearch-dashboards
您也可以通过提供版本号来升级到特定的 OpenSearch Dashboards 版本
sudo apt-get upgrade opensearch-dashboards=<version>
软件包升级后自动重启服务 (2.13.0+)
要在软件包升级后自动重启 OpenSearch Dashboards,请通过 systemd
启用 opensearch-dashboards.service
sudo systemctl enable opensearch-dashboards.service