我可以在 Ubuntu 上不使用 Docker 来安装 OpenSearch 吗?

问题描述 投票:0回答:2

所以我想为我的本地主机 Magento2 安装安装 OpenSearch,但我只能找到使用 Docker 的安装方法..

我没有使用 Docker 有几个原因,这与我现在所在的公司有关,但我真的很想在我自己的计算机上本地安装 OpenSearch,并在本地运行它,而不是使用其他程序像 Docker 一样,这可能吗?

顺便说一句;我使用的是 Ubuntu 22.04 和 Magento 2.4.6(如果知道这一点很重要的话)

提前致谢!

ubuntu magento magento2 opensearch
2个回答
5
投票

OpenSearch documentation 至少提供了几种无需 docker 即可安装的方法。我将在下面列出两种方法,以避免复制粘贴整个文档。

使用tarball(又名下载存档,解压并运行)

第 1 步:下载并解压 OpenSearch

# x64
wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.7.0/opensearch-2.7.0-linux-x64.tar.gz

# ARM64
wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.7.0/opensearch-2.7.0-linux-arm64.tar.gz

提取 tarball 的内容。

# x64
tar -xvf opensearch-2.7.0-linux-x64.tar.gz
   
# ARM64
tar -xvf opensearch-2.7.0-linux-arm64.tar.gz

第2步:配置重要的系统设置

禁用主机上的内存分页和交换性能以提高性能。

sudo swapoff -a

增加 OpenSearch 可用的内存映射数量。

sudo vi /etc/sysctl.conf

# Add a line to define the desired value
# or change the value if the key exists,
# and then save your changes.
vm.max_map_count=262144

使用 sysctl 重新加载内核参数,并通过检查值来验证更改是否已应用

sudo sysctl -p
cat /proc/sys/vm/max_map_count

第 3 步:运行 OpenSearch

cd /path/to/opensearch-2.7.0
./opensearch-tar-install.sh

来自 APT 存储库

安装必要的软件包。

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.pgp | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring

为 OpenSearch 创建 APT 存储库:

echo "deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | sudo tee /etc/apt/sources.list.d/opensearch-2.x.list

验证存储库是否已成功创建。

 sudo apt-get update

添加存储库信息后,列出 OpenSearch 的所有可用版本:

sudo apt list -a opensearch

选择您要安装的 OpenSearch 版本:

sudo apt-get install opensearch

要安装特定版本的 OpenSearch:

# Specify the version manually using opensearch=<version>
sudo apt-get install opensearch=2.7.0

完成后,启用 OpenSearch。

 sudo systemctl enable opensearch

开始打开搜索。

 sudo systemctl start opensearch
 sudo systemctl status opensearch

验证 OpenSearch 是否安装正确。

向端口9200发送请求:

curl -X GET https://localhost:9200 -u 'admin:admin' --insecure

您应该得到如下所示的响应:

 {
    "name" : "hostname",
    "cluster_name" : "opensearch",
    "cluster_uuid" : "6XNc9m2gTUSIoKDqJit0PA",
    "version" : {
       "distribution" : "opensearch",
       "number" : <version>,
       "build_type" : <build-type>,
       "build_hash" : <build-hash>,
       "build_date" : <build-date>,
       "build_snapshot" : false,
       "lucene_version" : <lucene-version>,
       "minimum_wire_compatibility_version" : "7.10.0",
       "minimum_index_compatibility_version" : "7.0.0"
    },
    "tagline" : "The OpenSearch Project: https://opensearch.org/"
 }

0
投票

由于 Magento2 最新版本仅支持 2.5.0 版本,因此我将分享直接从 APT 存储库安装的步骤。其中所有步骤都是从官方文档复制的:

从 APT 存储库安装 OpenSearch

APT 是基于 Debian 的操作系统的主要软件包管理工具,允许您从 APT 存储库下载并安装 Debian 软件包。

第 1 步: 安装必要的软件包。

sudo apt-get update && sudo apt-get -y install lsb-release ca-certificates curl gnupg2

第2步:导入GPG公钥。该密钥用于验证 APT 存储库是否已签名。

 curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring

第 3 步: 为 OpenSearch 创建 APT 存储库:

echo "deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | sudo tee /etc/apt/sources.list.d/opensearch-2.x.list

第4步:验证存储库是否已成功创建。

 sudo apt-get update

第 5 步: 添加存储库信息后,列出 OpenSearch 的所有可用版本:

sudo apt list -a opensearch

第 6 步: 选择您要安装的 OpenSearch 版本:

步骤 6.1: 除非另有说明,否则将安装 OpenSearch 的最新可用版本。

sudo apt-get install opensearch

步骤 6.2: 安装特定版本的 OpenSearch:

Specify the version manually using opensearch=<version>
Example: sudo apt-get install opensearch=2.5.0

完成后,启用 OpenSearch。

 sudo systemctl enable opensearch

开始打开搜索。

 sudo systemctl start opensearch

验证 OpenSearch 是否正确启动。

 sudo systemctl status opensearch

测试 OpenSearch

 curl -X GET https://localhost:9200 -u 'admin:admin' --insecure
You should get a response that looks like this:

 {
    "name":"hostname",
    "cluster_name":"opensearch",
    "cluster_uuid":"QqgpHCbnSRKcPAizqjvoOw",
    "version":{
       "distribution":"opensearch",
       "number":<version>,
       "build_type":<build-type>,
       "build_hash":<build-hash>,
       "build_date":<build-date>,
       "build_snapshot":false,
       "lucene_version":<lucene-version>,
       "minimum_wire_compatibility_version":"7.10.0",
       "minimum_index_compatibility_version":"7.0.0"
    },
    "tagline":"The OpenSearch Project: https://opensearch.org/"
 }

查询插件端点:

 curl -X GET https://localhost:9200/_cat/plugins?v -u 'admin:admin' --insecure
    
The response should look like this:

    name      component                           version
    hostname opensearch-alerting                  2.5.0.0
    hostname opensearch-anomaly-detection         2.5.0.0
    hostname opensearch-asynchronous-search       2.5.0.0
    hostname opensearch-cross-cluster-replication 2.5.0.0
    hostname opensearch-geospatial                2.5.0.0
    hostname opensearch-index-management          2.5.0.0
    hostname opensearch-job-scheduler             2.5.0.0
    hostname opensearch-knn                       2.5.0.0
    hostname opensearch-ml                        2.5.0.0
    hostname opensearch-neural-search             2.5.0.0
    hostname opensearch-notifications             2.5.0.0
    hostname opensearch-notifications-core        2.5.0.0
    hostname opensearch-observability             2.5.0.0
    hostname opensearch-performance-analyzer      2.5.0.0
    hostname opensearch-reports-scheduler         2.5.0.0
    hostname opensearch-security                  2.5.0.0
    hostname opensearch-security-analytics        2.5.0.0
    hostname opensearch-sql                       2.5.0.0
© www.soinside.com 2019 - 2024. All rights reserved.