OpenSearch · 14 min read · Oct 12, 2025

Debian 12にOpenSearchをインストールする方法

OpenSearchは、Amazonによって開発されたElasticsearchとKibanaのオープンソースフォークです。これは、フルテキスト検索と分析を可能にするリアルタイムで分散型のスケーラブルな検索エンジンです。大量のデータをインデックス化し、検索するために使用されます。OpenSearch Dashboards(Kibanaのフォーク)と共に展開されることが一般的で、OpenSearch用の強力なデータビジュアライゼーションダッシュボードです。OpenSearch Dashboardsを使用すると、OpenSearchのログデータを探索し、ダッシュボードやクエリを構築してアプリケーションに関する洞察を得ることができます。

このチュートリアルでは、Debian 12サーバーにOpenSearchをインストールする方法を示します。また、カスタムTLS証明書でインストールを保護し、OpenSearchで認証を有効にする方法も学びます。

前提条件

  • 最低4GBのRAMを搭載したDebian 12を実行しているサーバー。

  • sudo権限を持つ非rootユーザー。

  • 簡単なファイアウォール(UFW)が有効で実行中であること。

  • サーバーを指す完全修飾ドメイン名(FQDN)opensearch.example.com。これは、プロキシサーバーを使用してSSL経由でOpenSearch Dashboardsを提供したい場合に便利です。

  • すべてが更新されていること。 $ sudo apt update && sudo apt upgrade

  • チュートリアルとCraft CMSを実行するためにいくつかの必須パッケージが必要です。これらのいくつかはすでにサーバーにインストールされているでしょう。 $ sudo apt install curl wget nano software-properties-common dirmngr apt-transport-https ca-certificates lsb-release debian-archive-keyring gnupg2 ufw unzip -y

ステップ1 - ファイアウォールの設定

パッケージをインストールする前の最初のステップは、HTTPおよびHTTPS接続を許可するためにファイアウォールを設定することです。

ファイアウォールの状態を確認します。

$ sudo ufw status

次のような出力が表示されるはずです。

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)

HTTPおよびHTTPSポートを許可します。

$ sudo ufw allow http
$ sudo ufw allow https

確認のために再度状態をチェックします。

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)

ステップ2 - システムの準備

OpenSearchをインストールする前に、システムを準備して最適化する必要があります。これには、スワップメモリを無効にすること、システムのメモリマップの数を設定すること、システムホスト名を設定することなど、いくつかのステップが含まれます。

まず、スワップメモリが有効になっているかどうかを確認します。

$ free -m

スワップが有効になっている場合、次のような出力が表示されるはずです。

               total        used        free      shared  buff/cache   available
Mem:            7945        1083        6492          34         636        6861
Swap:           4242           0        4242

スワップスペースを永久に無効にするために、次のコマンドを実行します。

$ sudo swapoff -a
$ sudo sed -i '/ swap / s/^\(.*\)$/#
1/g' /etc/fstab

再度スワップメモリを確認すると、次のように表示されるはずです。

               total        used        free      shared  buff/cache   available
Mem:            7945        1113        6449          37         651        6831
Swap:              0           0           0

OpenSearchはデフォルトでmapfsディレクトリを使用してインデックスを保存します。デフォルトのオペレーティングシステムのnmapカウントの制限は低すぎるため、メモリエラーが発生する可能性があります。

vm.max_map_count変数の現在の値を確認します。

$ sysctl -n vm.max_map_count
65530

各プロセスで使用されるメモリマップの数を増やすには、次のコマンドを実行します。

$ sudo sysctl -w vm.max_map_count=262144

これは、システムが再起動されるまで有効です。この値を永続的にするには、次のコマンドを使用して/etc/sysctl.confファイルにvm.max_map_count=262144の行を追加します。

$ echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf

システムを再起動するか、次のコマンドを実行することで変更を永続化できます。

$ sudo sysctl -p

最後のステップはホスト名の設定です。サーバーをホスティングしている場所によっては、一部のクラウド会社がコントロールパネルを介してホスト名を直接設定することを許可しています。ただし、ターミナルを介して行う方が良いです。

次のコマンドを実行してホスト名を設定します。

$ sudo hostnamectl set-hostname opensearch

FQDN(完全修飾ドメイン名)を/etc/hostsファイルに追加します。ここでは、ホスト名opensearchをドメイン名opensearch.example.comにマッピングし、サーバーのIPアドレスを指します。以下のコマンドのをサーバーのIPアドレスに置き換えます。

$ echo "  opensearch.example.com  opensearch" | sudo tee -a /etc/hosts

次のコマンドを使用してホスト名とFQDNを確認します。

$ hostname
opensearch
$ hostname -f
opensearch.example.com

これで、OpenSearchと連携するためにシステムを最適化するプロセスが完了しました。

ステップ3 - OpenSearchのインストール

インストールパッケージに署名するために使用されるOpenSearch GPGキーをインポートします。

$  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 update

利用可能なOpenSearchのすべてのバージョンを確認します。

$ sudo apt list -a opensearch
Listing... Done
opensearch/stable 2.12.0 amd64
opensearch/stable 2.11.1 amd64
opensearch/stable 2.11.0 amd64
opensearch/stable 2.10.0 amd64
opensearch/stable 2.9.0 amd64
opensearch/stable 2.8.0 amd64
opensearch/stable 2.7.0 amd64
opensearch/stable 2.6.0 amd64
opensearch/stable 2.5.0 amd64

OpenSearchの最新バージョンv2.12.0をインストールするには、インストール前に管理者デモパスワードを設定する必要があります。さもなければ、インストールは失敗します。

次のコマンドを使用して最新バージョンのOpenSearchをインストールできます。インストールコマンド自体で環境変数を使用して管理者デモパスワードを設定できます。強力なパスワードを選択してください。

$ sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD= apt install opensearch

インストール中に次の警告が表示された場合は、安全に無視できます。

......
chown: warning: '.' should be ':': ‘opensearch.opensearch’
chown: warning: '.' should be ':': ‘opensearch.opensearch’
chown: warning: '.' should be ':': ‘opensearch.opensearch’
chown: warning: '.' should be ':': ‘opensearch.opensearch’
chown: warning: '.' should be ':': ‘opensearch.opensearch’
......

または、特定のバージョンをインストールすることもできます。

$ sudo apt install opensearch=2.11.1

サービスデーモンをリロードします。

$ sudo systemctl daemon-reload

OpenSearchサービスを有効にします。

$ sudo systemctl enable opensearch

OpenSearchサービスを開始します。

$ sudo systemctl start opensearch

OpenSearchサービスの状態を確認します。

$ sudo systemctl status opensearch

次のような出力が得られるはずです。

? opensearch.service - OpenSearch
     Loaded: loaded (/lib/systemd/system/opensearch.service; enabled; preset: enabled)
     Active: active (running) since Sat 2024-03-02 06:37:01 UTC; 5s ago
       Docs: https://opensearch.org/
   Main PID: 31109 (java)
      Tasks: 75 (limit: 4652)
     Memory: 1.3G
        CPU: 1min 3.128s
     CGroup: /system.slice/opensearch.service
             ??31109 /usr/share/opensearch/jdk/bin/java -Xshare:auto -Dopensearch.networkaddress.cache.ttl=60 -Dopensearch.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true...

ステップ4 - OpenSearchのテスト

さらに進む前に、インストールが正常に機能しているかどうかを確認しましょう。次のコマンドを実行してOpenSearchが意図した通りに動作しているかを確認します。

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

次のような出力が得られるはずです。

{
  "name" : "opensearch",
  "cluster_name" : "opensearch",
  "cluster_uuid" : "3oFvYn96St2MOpDP3Sf29g",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.12.0",
    "build_type" : "deb",
    "build_hash" : "2c355ce1a427e4a528778d4054436b5c4b756221",
    "build_date" : "2024-02-20T02:18:31.541484890Z",
    "build_snapshot" : false,
    "lucene_version" : "9.9.2",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

OpenSearchプラグインエンドポイントをクエリして、利用可能なプラグインのリストを確認します。

$ curl -X GET https://localhost:9200/_cat/plugins?v -u 'admin:' --insecure

次のコマンドでも同様のことができます。

$ /usr/share/opensearch/bin/opensearch-plugin list

次のような出力が得られるはずです。

name       component                            version
opensearch opensearch-alerting                  2.12.0.0
opensearch opensearch-anomaly-detection         2.12.0.0
opensearch opensearch-asynchronous-search       2.12.0.0
opensearch opensearch-cross-cluster-replication 2.12.0.0
opensearch opensearch-custom-codecs             2.12.0.0
opensearch opensearch-flow-framework            2.12.0.0
opensearch opensearch-geospatial                2.12.0.0
opensearch opensearch-index-management          2.12.0.0
opensearch opensearch-job-scheduler             2.12.0.0
opensearch opensearch-knn                       2.12.0.0
opensearch opensearch-ml                        2.12.0.0
opensearch opensearch-neural-search             2.12.0.0
opensearch opensearch-notifications             2.12.0.0
opensearch opensearch-notifications-core        2.12.0.0
opensearch opensearch-observability             2.12.0.0
opensearch opensearch-performance-analyzer      2.12.0.0
opensearch opensearch-reports-scheduler         2.12.0.0
opensearch opensearch-security                  2.12.0.0
opensearch opensearch-security-analytics        2.12.0.0
opensearch opensearch-skills                    2.12.0.0
opensearch opensearch-sql                       2.12.0.0

次のコマンドを使用して追加のプラグインをインストールできます。

$ /usr/share/opensearch/bin/opensearch-plugin install 

利用可能なOpenSearchプラグインのリストは、公式ウェブサイトで確認できます。

ステップ5 - OpenSearchの設定

OpenSearchのデフォルト設定は、プロダクション環境には適していません。デフォルトでは、OpenSearchはネットワークインターフェースにバインドされておらず、外部からアクセスできません。さらに、デフォルトのユーザー名とパスワードが使用されており、プロダクション環境で直接使用するとセキュリティ上の問題が発生する可能性があります。

OpenSearchはその設定を/etc/opensearch/opensearch.ymlファイルに保存します。編集のために開きます。

$ sudo nano /etc/opensearch/opensearch.yml

#network.host: 192.168.0.1の行を見つけ、ハッシュ(#)を削除してコメントを解除し、次のように値を変更します。これにより、OpenSearchがすべての利用可能なインターフェースにバインドされます。特定のインターフェースにバインドするために特定のIPを入力することもできます。

# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0

ファイルの下部に次の行を追加します。

# Unless you have already configured a cluster, you should set
# discovery.type to single-node, or the bootstrap checks will
# fail when you try to start the service.
discovery.type: single-node

# If you previously disabled the Security plugin in opensearch.yml,
# be sure to re-enable it. Otherwise you can skip this setting.
plugins.security.disabled: false

単一のサーバーにインストールしているため、discovery.typesingle-nodeに設定しました。plugins.security.disabledfalseに設定すると、OpenSearchセキュリティプラグインが有効になります。

ファイルを保存するには、Ctrl + Xを押し、プロンプトが表示されたらYを入力します。

初期および最大JVM(Java仮想メモリ)ヒープサイズを指定する必要があります。この設定は、サーバーのRAMサイズに依存します。たとえば、4GBのRAMを搭載したサーバーを使用しているため、ヒープサイズを3GBに設定します。

/etc/opensearch/jvm.options.dディレクトリにheapsize.optionsを作成して開き、編集します。これにより、/etc/opensearch/jvm.optionsファイルに設定されたデフォルト値が上書きされます。

$ sudo nano /etc/opensearch/jvm.options.d/heapsize.options

次の行を追加します。

-Xms3g
-Xmx3g

ファイルを保存するには、Ctrl + Xを押し、プロンプトが表示されたらYを入力します。

変更を適用するためにOpenSearchサービスを再起動します。

$ sudo systemctl restart opensearch

次のコマンドを使用して現在のヒープサイズと最大メモリを確認できます。

$ curl -sS "https://localhost:9200/_cat/nodes?h=heap*&v" -u 'admin:' --insecure

次のような出力が得られるはずです。

heap.current heap.percent heap.max
     345.5mb           11      3gb

ステップ6 - OpenSearchのTLSの設定

ここでは、OpenSearchを保護するための証明書を生成します。TLS証明書は、クライアントがホストのアイデンティティを確認し、クライアントとホスト間のトラフィックを暗号化することによってセキュリティを提供します。次の証明書を生成します。

  1. ルートCA証明書 - これらは、他のすべての証明書に署名する主要な証明書です。
  2. 管理者証明書 - これらの証明書は、セキュリティプラグインに関連する管理タスクを実行するための権限を取得するために使用されます。
  3. ノード証明書 - これらの証明書は、ノードとクライアント間の通信に使用されます。

すべてのOpenSearch証明書は/etc/opensearchディレクトリに保存されます。最初のステップは、OpenSearchのインストール中に設定されたデフォルトの証明書を削除することです。

OpenSearchディレクトリに移動します。

$ cd /etc/opensearch

デフォルトの証明書を削除します。

$ sudo rm -f *.pem

OpenSearch設定ファイルを編集のために開きます。

$ sudo nano opensearch.yml

次のコードをファイルの下部にコメントアウトします。OpenSearch Security Demo Configurationセクション内の各行の前にハッシュを追加します。

######## Start OpenSearch Security Demo Configuration ########
# WARNING: revise all the lines below before you go into production
#plugins.security.ssl.transport.pemcert_filepath: esnode.pem
#plugins.security.ssl.transport.pemkey_filepath: esnode-key.pem
#plugins.security.ssl.transport.pemtrustedcas_filepath: root-ca.pem
#plugins.security.ssl.transport.enforce_hostname_verification: false
#plugins.security.ssl.http.enabled: true
#plugins.security.ssl.http.pemcert_filepath: esnode.pem
#plugins.security.ssl.http.pemkey_filepath: esnode-key.pem
#plugins.security.ssl.http.pemtrustedcas_filepath: root-ca.pem
#plugins.security.allow_unsafe_democertificates: true
#plugins.security.allow_default_init_securityindex: true
#plugins.security.authcz.admin_dn: ['CN=kirk,OU=client,O=client,L=test,C=de']
#plugins.security.audit.type: internal_opensearch
#plugins.security.enable_snapshot_restore_privilege: true
#plugins.security.check_snapshot_restore_write_privileges: true
#plugins.security.restapi.roles_enabled: [all_access, security_rest_api_access]
#plugins.security.system_indices.enabled: true
#plugins.security.system_indices.indices: [.plugins-ml-config, .plugins-ml-connector,
#  .plugins-ml-model-group, .plugins-ml-model, .plugins-ml-task, .plugins-ml-conversation-meta,
#  .plugins-ml-conversation-interactions, .plugins-ml-memory-meta, .plugins-ml-memory-message,
#  .opendistro-alerting-config, .opendistro-alerting-alert*, .opendistro-anomaly-results*,
#  .opendistro-anomaly-detector*, .opendistro-anomaly-checkpoints, .opendistro-anomaly-detection-state,
#  .opendistro-reports-*, .opensearch-notifications-*, .opensearch-notebooks, .opensearch-observability,
#  .ql-datasources, .opendistro-asynchronous-search-response*, .replication-metadata-store,
#  .opensearch-knn-models, .geospatial-ip2geo-data*, .plugins-flow-framework-config,
#  .plugins-flow-framework-templates, .plugins-flow-framework-state]
#node.max_local_storage_nodes: 3
######## End OpenSearch Security Demo Configuration ########

ファイルを保存するには、Ctrl + Xを押し、プロンプトが表示されたらYを入力します。

次に、/etc/opensearchディレクトリ内に証明書を保存するためのディレクトリを作成します。

$ sudo mkdir /etc/opensearch/certs

証明書を生成する際にsudoを使用しないように、ディレクトリの権限を現在のログインユーザーに変更します。

$ sudo chown $USER:$USER /etc/opensearch/certs -R

証明書ディレクトリに移動します。

$ cd /etc/opensearch/certs

ルート証明書の生成

ルート証明書のプライベートキーを生成します。

$ openssl genrsa -out root-ca-key.pem 2048

自己署名のルートCA証明書を生成します。-subjパラメータを使用して、証明書に埋め込まれる情報を提供します。-subjフラグを使用しない場合、すべての情報を尋ねられます。

$ openssl req -new -x509 -sha256 -key root-ca-key.pem -subj "/C=CA/ST=ONTARIO/L=TORONTO/O=ORG/OU=UNIT/CN=ROOT" -out root-ca.pem -days 730

特定のホストに合わせて情報を変更できます。

-subjパラメータの変数は次の意味です。

C = 国名(2文字コード)、ST = 州または省名(フルネーム)、L = 地名(例:都市)、O = 組織名、OU = 組織単位名(例:セクション)、CN = コモンネーム(例:サーバーFQDN)

ルート証明書が生成されました。

管理者証明書の生成

次のコマンドを使用して管理者証明書のプライベートキーを生成します。

$ openssl genrsa -out admin-key-temp.pem 2048

プライベートキーをJavaで使用するためにPKCS#8形式に変換します。PKCS#12互換アルゴリズム(3DES)を使用します。

$ openssl pkcs8 -inform PEM -outform PEM -in admin-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out admin-key.pem

プライベートキーから管理者CSR(証明書署名要求)を生成します。この証明書はホストに結びついていないため、昇格されたアクセスを認証するために使用されます。コモンネーム(CN)にはAの値を使用します。

$ openssl req -new -key admin-key.pem -subj "/C=CA/ST=ONTARIO/L=TORONTO/O=ORG/OU=UNIT/CN=A" -out admin.csr

ルート証明書とプライベートキーを使用して管理者CSRに署名します。

$ openssl x509 -req -in admin.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out admin.pem -days 730
Certificate request self-signature ok
subject=C = CA, ST = ONTARIO, L = TORONTO, O = ORG, OU = UNIT, CN = A

ノード証明書の生成

ノード証明書のプライベートキーを生成します。

$ openssl genrsa -out node1-key-temp.pem 2048

ノードプライベートキーをPKCS#8形式に変換します。

$ openssl pkcs8 -inform PEM -outform PEM -in node1-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out node1-key.pem

プライベートキーからノード証明書の新しいCSRを作成します。CN変数の値をノードのホスト名に変更してください。この証明書はホストに結びついており、ノードのホスト名またはIPアドレスと一致する必要があります。

$ openssl req -new -key node1-key.pem -subj "/C=CA/ST=ONTARIO/L=TORONTO/O=ORG/OU=UNIT/CN=opensearch.example.com" -out node1.csr

ノードのホスト名またはFQDNまたはIPアドレスを含むSAN(Subject Alternative Name)拡張ファイルを作成します。

$ sh -c 'echo subjectAltName=DNS:opensearch.example.com > node1.ext'

ルート証明書とプライベートキーを使用してノード証明書CSRに署名します。

$ openssl x509 -req -in node1.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out node1.pem -days 730 -extfile node1.ext
Certificate request self-signature ok
subject=C = CA, ST = ONTARIO, L = TORONTO, O = ORG, OU = UNIT, CN = opensearch.example.com

インストール用の証明書の準備

一時的な証明書、CSR、およびSAN拡張ファイルを削除します。

$ rm -f *temp.pem *csr *ext

次に、ルートCA証明書をサーバーにインストールします。そのために、ルートCA証明書を.crt形式に変換します。

$ openssl x509 -outform der -in root-ca.pem -out root-ca.crt

root-ca.crtファイルを/usr/local/share/ca-certificates/ディレクトリにコピーします。

$ sudo cp root-ca.crt /usr/local/share/ca-certificates/

次のコマンドを使用してDebianサーバーにルートCA証明書を追加します。

$ sudo update-ca-certificates

次の出力(1 added)が表示され、ルートCA証明書がシステムに追加されたことを確認します。

Updating certificates in /etc/ssl/certs...
rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL
rehash: warning: skipping root-ca.pem,it does not contain exactly one certificate or CRL
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.

ディレクトリの所有権をopensearchユーザーに戻します。

$ sudo chown opensearch:opensearch /etc/opensearch/certs -R

ディレクトリの権限を0700に変更します。

$ sudo chmod 0700 /etc/opensearch/certs

証明書の権限を0600に変更します。

$ sudo chmod 0600 /etc/opensearch/certs/{admin-key,admin,node1-key,node1,root-ca-key,root-ca}.pem
$ sudo chmod 0600 /etc/opensearch/certs/root-ca.crt

ステップ7 - OpenSearchにTLSをインストール

すべての証明書が生成され、設定されたので、OpenSearchインストールに証明書を追加する時が来ました。

最初のステップは、作成したすべての証明書とTLSセキュリティプラグイン設定をOpenSearch設定ファイル(/etc/opensearch/opensearch.yml)に追加するbashスクリプトを作成することです。

add-opensearch-tls.shという名前のファイルを作成し、編集のために開きます。

$ cd ~
$ nano add-opensearch-tls.sh

次のコードを貼り付けます。

#! /bin/bash

# Before running this script, make sure to replace the CN in the 
# node's distinguished name with a real DNS A record.

echo "plugins.security.ssl.transport.pemcert_filepath: /etc/opensearch/certs/node1.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.transport.pemkey_filepath: /etc/opensearch/certs/node1-key.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.transport.pemtrustedcas_filepath: /etc/opensearch/certs/root-ca.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.http.enabled: true" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.http.pemcert_filepath: /etc/opensearch/certs/node1.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.http.pemkey_filepath: /etc/opensearch/certs/node1-key.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.http.pemtrustedcas_filepath: /etc/opensearch/certs/root-ca.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.allow_default_init_securityindex: true" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.authcz.admin_dn:" | sudo tee -a /etc/opensearch/opensearch.yml
echo "  - 'CN=A,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA'" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.nodes_dn:" | sudo tee -a /etc/opensearch/opensearch.yml
echo "  - 'CN=opensearch.example.com,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA'" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.audit.type: internal_opensearch" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.enable_snapshot_restore_privilege: true" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.check_snapshot_restore_write_privileges: true" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.restapi.roles_enabled: [\"all_access\", \"security_rest_api_access\"]" | sudo tee -a /etc/opensearch/opensearch.yml

ファイルを保存するには、Ctrl + Xを押し、プロンプトが表示されたらYを入力します。

ファイルを実行可能にします。

$ chmod +x add-opensearch-tls.sh

スクリプトを実行します。

$ ./add-opensearch-tls.sh

次の出力が得られるはずです。

plugins.security.ssl.transport.pemcert_filepath: /etc/opensearch/certs/node1.pem
plugins.security.ssl.transport.pemkey_filepath: /etc/opensearch/certs/node1-key.pem
plugins.security.ssl.transport.pemtrustedcas_filepath: /etc/opensearch/certs/root-ca.pem
plugins.security.ssl.http.enabled: true
plugins.security.ssl.http.pemcert_filepath: /etc/opensearch/certs/node1.pem
plugins.security.ssl.http.pemkey_filepath: /etc/opensearch/certs/node1-key.pem
plugins.security.ssl.http.pemtrustedcas_filepath: /etc/opensearch/certs/root-ca.pem
plugins.security.allow_default_init_securityindex: true
plugins.security.authcz.admin_dn:
  - 'CN=A,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA'
plugins.security.nodes_dn:
  - 'CN=opensearch.example.com,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA'
plugins.security.audit.type: internal_opensearch
plugins.security.enable_snapshot_restore_privilege: true
plugins.security.check_snapshot_restore_write_privileges: true
plugins.security.restapi.roles_enabled: ["all_access", "security_rest_api_access"]

/etc/opensearch/opensearch.ymlファイルを開いて、設定が適用されているか確認します。

$ sudo nano /etc/opensearch/opensearch.yml

ファイルの下部にスクロールすると、次のように表示されるはずです。

# If you previously disabled the Security plugin in opensearch.yml,
# be sure to re-enable it. Otherwise you can skip this setting.
plugins.security.disabled: false
....
plugins.security.ssl.transport.pemcert_filepath: /etc/opensearch/certs/node1.pem
plugins.security.ssl.transport.pemkey_filepath: /etc/opensearch/certs/node1-key.pem
plugins.security.ssl.transport.pemtrustedcas_filepath: /etc/opensearch/certs/root-ca.pem
plugins.security.ssl.http.enabled: true
plugins.security.ssl.http.pemcert_filepath: /etc/opensearch/certs/node1.pem
plugins.security.ssl.http.pemkey_filepath: /etc/opensearch/certs/node1-key.pem
plugins.security.ssl.http.pemtrustedcas_filepath: /etc/opensearch/certs/root-ca.pem
plugins.security.allow_default_init_securityindex: true
plugins.security.authcz.admin_dn:
  - 'CN=A,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA'
plugins.security.nodes_dn:
  - 'CN=opensearch.example.com,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA'
plugins.security.audit.type: internal_opensearch
plugins.security.enable_snapshot_restore_privilege: true
plugins.security.check_snapshot_restore_write_privileges: true
plugins.security.restapi.roles_enabled: ["all_access", "security_rest_api_access"]

満足したら、Ctrl + Xを押してファイルを保存します。

ステップ8 - OpenSearchユーザーの作成

このステップでは、adminユーザー以外のすべてのデモユーザーを削除し、デフォルトのadminパスワードをスクリプトを使用して置き換えます。

OpenSearchセキュリティプラグインツールディレクトリに移動します。

$ cd /usr/share/opensearch/plugins/opensearch-security/tools

新しいパスワードを生成するためにhash.shスクリプトを実行します。

$ ./hash

Java実行可能ファイル(JDK)のパスが定義されていないため、スクリプトは失敗し、次のエラーが表示されます。

************************************************************************
 This tool will be deprecated in the next major release of OpenSearch 
 https://github.com/opensearch-project/security/issues/1755           
**********************************************************************
WARNING: nor OPENSEARCH_JAVA_HOME nor JAVA_HOME is set, will use 
./hash.sh: line 35: java: command not found

次のコマンドを実行して、OPENSEARCH_JAVA_HOME環境変数をJDKの場所で宣言して再度実行します。

$ OPENSEARCH_JAVA_HOME=/usr/share/opensearch/jdk ./hash.sh

次のような出力が得られるはずです。

**********************************************************************
 This tool will be deprecated in the next major release of OpenSearch 
 https://github.com/opensearch-project/security/issues/1755           
**********************************************************************
[Password:]
$2y$12$4NL0LqEnN4FXaUdQQC.gOupeCQT2IuMo9gN0b5d3nxdMVbLX088f2

生成されたパスワードハッシュが必要になります。

/etc/opensearch/opensearch-security/internal_users.ymlのOpenSearchユーザー設定ファイルを編集のために開きます。

$ sudo nano /etc/opensearch/opensearch-security/internal_users.yml

すべてのデモユーザーの前にハッシュを追加してコメントアウトします。

---
# This is the internal user database
# The hash value is a bcrypt hash and can be generated with plugin/tools/hash.sh

_meta:
  type: "internalusers"
  config_version: 2

# Define your internal users here

## Demo users

#admin:
#  hash: "$2y$12$Twy84uxOX0SQ1QMQ68og8O/i1MvqWItt/phZX3DiJMjpBoT9u9KX6"
#  reserved: true
#  backend_roles:
#  - "admin"
#  description: "Demo admin user"

#anomalyadmin:

上記で生成したハッシュを使用してadminユーザーを追加します。

---
# This is the internal user database
# The hash value is a bcrypt hash and can be generated with plugin/tools/hash.sh

_meta:
  type: "internalusers"
  config_version: 2

# Define your internal users here

admin:
  hash: "$2y$12$4NL0LqEnN4FXaUdQQC.gOupeCQT2IuMo9gN0b5d3nxdMVbLX088f2"
  reserved: true
  backend_roles:
  - "admin"
  description: "Admin user"

## Demo users

#admin:

完了したら、Ctrl + Xを押してファイルを保存します。

TLS証明書がインストールされ、デモユーザーが削除または新しいパスワードが割り当てられたので、設定変更を適用する時が来ました。変更を適用するために、/usr/share/opensearch/plugins/opensearch-security/toolsディレクトリ内のsecurityadmin.shスクリプトを呼び出します。このスクリプトは、OpenSearchサービスが実行されている必要があります。

OpenSearchサービスを再起動します。

$ sudo systemctl restart opensearch

/usr/share/opensearch/plugins/opensearch-security/toolsディレクトリに移動します。

$ cd /usr/share/opensearch/plugins/opensearch-security/tools

次のコマンドを使用してスクリプトを実行します。

$ sudo OPENSEARCH_JAVA_HOME=/usr/share/opensearch/jdk ./securityadmin.sh -h opensearch.nspeaks.com -p 9200 -cd /etc/opensearch/opensearch-security/ -cacert /etc/opensearch/certs/root-ca.pem -cert /etc/opensearch/certs/admin.pem -key /etc/opensearch/certs/admin-key.pem -icl -nhnv

セキュリティプラグインは、ユーザー、権限、ロール、バックエンド設定を含む構成をOpenSearchクラスターのシステムインデックスに保存します。これにより、クラスターを再起動せずに設定を変更でき、すべてのノードで構成ファイルを編集する必要がなくなります。これは、securityadmin.shスクリプトを実行することで実現されます。

  • -cdオプションは、セキュリティプラグイン構成ファイルがどこにあるかを指定します。
  • -icl--ignore-clustername)オプションは、セキュリティプラグインにクラスター名に関係なく構成をアップロードするように指示します。-cn--clustername)オプションを使用する代わりにクラスター名を指定することもできます。
  • 証明書が自己署名されているため、-nhnv--disable-host-name-verification)オプションを使用します。
  • --cacert--cert--keyオプションは、ルート証明書、管理者証明書、および管理者証明書のプライベートキーの場所を定義します。プライベートキーにパスワードがある場合は、-keypassオプションを使用して定義できます。

OpenSearchのドキュメントでセキュリティプラグインの構成について詳しく学ぶことができます。

次のコマンドを実行すると、次のような出力が得られるはずです。

**********************************************************************
 This tool will be deprecated in the next major release of OpenSearch 
 https://github.com/opensearch-project/security/issues/1755           
************************************************************************
Security Admin v7
Will connect to opensearch:9200 ... done
Connected as "CN=A,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA"
OpenSearch Version: 2.12.0
Contacting opensearch cluster 'opensearch' and wait for YELLOW clusterstate ...
Clustername: opensearch
Clusterstate: GREEN
Number of nodes: 1
Number of data nodes: 1
.opendistro_security index already exists, so we do not need to create one.
Populate config from /etc/opensearch/opensearch-security/
Will update '/config' with /etc/opensearch/opensearch-security/config.yml 
   SUCC: Configuration for 'config' created or updated
Will update '/roles' with /etc/opensearch/opensearch-security/roles.yml 
   SUCC: Configuration for 'roles' created or updated
Will update '/rolesmapping' with /etc/opensearch/opensearch-security/roles_mapping.yml 
   SUCC: Configuration for 'rolesmapping' created or updated
Will update '/internalusers' with /etc/opensearch/opensearch-security/internal_users.yml 
   SUCC: Configuration for 'internalusers' created or updated
Will update '/actiongroups' with /etc/opensearch/opensearch-security/action_groups.yml 
   SUCC: Configuration for 'actiongroups' created or updated
Will update '/tenants' with /etc/opensearch/opensearch-security/tenants.yml 
   SUCC: Configuration for 'tenants' created or updated
Will update '/nodesdn' with /etc/opensearch/opensearch-security/nodes_dn.yml 
   SUCC: Configuration for 'nodesdn' created or updated
Will update '/whitelist' with /etc/opensearch/opensearch-security/whitelist.yml 
   SUCC: Configuration for 'whitelist' created or updated
Will update '/audit' with /etc/opensearch/opensearch-security/audit.yml 
   SUCC: Configuration for 'audit' created or updated
Will update '/allowlist' with /etc/opensearch/opensearch-security/allowlist.yml 
   SUCC: Configuration for 'allowlist' created or updated
SUCC: Expected 10 config types for node {"updated_config_types":["allowlist","tenants","rolesmapping","nodesdn","audit","roles","whitelist","internalusers","actiongroups","config"],"updated_config_size":10,"message":null} is 10 (["allowlist","tenants","rolesmapping","nodesdn","audit","roles","whitelist","internalusers","actiongroups","config"]) due to: null
Done with success

新しい資格情報を次のコマンドを使用して確認します。

前回のテストでは、リクエストをlocalhostに向けました。TLS証明書が設定され、新しい証明書がホストの実際のDNSレコードを参照するため、localhostへのリクエストはCNチェックに失敗し、証明書は無効と見なされます。したがって、次のコマンドで実際のDNSレコードを追加して確認します。

$ curl https://your.host.address:9200 -u admin:yournewpassword -k

次のような応答が表示されるはずです。

{
  "name" : "opensearch",
  "cluster_name" : "opensearch",
  "cluster_uuid" : "3oFvYn96St2MOpDP3Sf29g",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.12.0",
    "build_type" : "deb",
    "build_hash" : "2c355ce1a427e4a528778d4054436b5c4b756221",
    "build_date" : "2024-02-20T02:18:31.541484890Z",
    "build_snapshot" : false,
    "lucene_version" : "9.9.2",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

ステップ9 - OpenSearch Dashboardsのインストール

OpenSearchをすでにインストールしたので、OpenSearch GPGキーのインポートステップをスキップできます。

OpenSearchダッシュボードをインストールするには、次のコマンドを実行してAPTリポジトリを作成します。

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

システムリポジトリリストを更新します。

$ sudo apt update

利用可能なOpenSearch Dashboardsのすべてのバージョンをリストします。

$ sudo apt list -a opensearch-dashboards

次のような出力が得られるはずです。

Listing... Done
opensearch-dashboards/stable 2.12.0 amd64
opensearch-dashboards/stable 2.11.1 amd64
opensearch-dashboards/stable 2.11.0 amd64
opensearch-dashboards/stable 2.10.0 amd64
opensearch-dashboards/stable 2.9.0 amd64
opensearch-dashboards/stable 2.8.0 amd64
opensearch-dashboards/stable 2.7.0 amd64
opensearch-dashboards/stable 2.6.0 amd64
opensearch-dashboards/stable 2.5.0 amd64

最新バージョンのOpenSearch Dashboardをインストールします。

$ sudo apt install opensearch-dashboards

または、特定のバージョンのOpenSearch Dashboardをインストールします。

$ sudo apt install opensearch-dashboards=2.12.0

OpenSearchダッシュボードとOpenSearchのバージョンは同じである必要があります。そうでないと、複数の問題が発生する可能性があります。

サービスデーモンをリロードします。

$ sudo systemctl daemon-reload

OpenSearch Dashboardsサービスを有効にします。

$ sudo systemctl enable opensearch-dashboards

OpenSearch Dashboardsサービスを開始します。

$ sudo systemctl start opensearch-dashboards

OpenSearch Dashboardsサービスの状態を確認します。

$ sudo systemctl status opensearch-dashboards

次のような出力が得られるはずです。

? opensearch-dashboards.service - "OpenSearch Dashboards"
     Loaded: loaded (/lib/systemd/system/opensearch-dashboards.service; enabled; preset: enabled)
     Active: active (running) since Sat 2024-03-02 16:01:25 UTC; 4s ago
   Main PID: 7098 (node)
      Tasks: 11 (limit: 9484)
     Memory: 175.4M
        CPU: 5.389s
     CGroup: /system.slice/opensearch-dashboards.service
             ??7098 /usr/share/opensearch-dashboards/node/bin/node /usr/share/opensearch-dashboards/src/cli/dist

Mar 02 16:01:25 opensearch systemd[1]: Started opensearch-dashboards.service - "OpenSearch Dashboards".

ステップ10 - OpenSearch Dashboardsの設定

OpenSearch Dashboardsはその設定を/etc/opensearch-dashboards/opensearch_dashboards.ymlファイルに保存します。編集のために開きます。

$ sudo nano /etc/opensearch-dashboards/opensearch_dashboards.yml

# server.host: "localhost"の行を見つけ、ハッシュを削除してコメントを解除し、次のように値を変更します。

# Specifies the address to which the OpenSearch Dashboards server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: 0.0.0.0

server.hostの値を0.0.0.0に設定すると、OpenSearch Dashboardが外部IPにバインドされ、World Wide Webを介してアクセスできるようになります。リバースプロキシを介してSSLでダッシュボードを提供したい場合は、この値を変更しないでください。

次のセクションを見つけるまでスクロールします。

opensearch.hosts: [https://localhost:9200]
opensearch.ssl.verificationMode: none
opensearch.username: kibanaserver
opensearch.password: kibanaserver
opensearch.requestHeadersWhitelist: [authorization, securitytenant]

OpenSearchインストール用に設定された値に変更します。

opensearch.hosts: [https://opensearch:9200]
opensearch.ssl.verificationMode: none
opensearch.username: admin
opensearch.password: 
opensearch.requestHeadersWhitelist: [authorization, securitytenant]

完了したら、Ctrl + Xを押してファイルを保存します。

OpenDashboardsサービスを再起動します。

$  sudo systemctl restart opensearch-dashboards

UFWファイアウォールでポート5601を開きます。

$ sudo ufw allow 5601

URL http://:5601またはhttp://opensearch.example.com:5601を開いて、OpenSearch Dashboardsウェブサイトを起動します。

OpenSearch Dashboards Login

HTTP経由でポート番号を含むURLでOpenSearch Dashboardsにアクセスすることに満足している場合は、ここで終了できます。ただし、SSL経由でダッシュボードを提供する方が良いです。そのために、Nginxをリバースプロキシとしてインストールし、SSLを提供します。

ステップ11 - Nginxのインストール

Debian 12には古いバージョンのNginxが付属しています。最新バージョンをインストールするには、公式Nginxリポジトリをダウンロードする必要があります。

Nginxの署名キーをインポートします。

$ curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
    | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null

Nginxのメインラインバージョンのリポジトリを追加します。

$ echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/mainline/debian `lsb_release -cs` nginx" \
    | sudo tee /etc/apt/sources.list.d/nginx.list

システムリポジトリを更新します。

$ sudo apt update

Nginxをインストールします。

$ sudo apt install nginx

インストールを確認します。Debianシステムでは、次のコマンドはsudoでのみ機能します。

$ sudo nginx -v
nginx version: nginx/1.25.4

Nginxサーバーを開始します。

$ sudo systemctl start nginx

サービスの状態を確認します。

$ sudo systemctl status nginx
? nginx.service - nginx - high performance web server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
     Active: active (running) since Sat 2024-03-02 12:53:57 UTC; 4s ago
       Docs: https://nginx.org/en/docs/
    Process: 3976 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
   Main PID: 3977 (nginx)
      Tasks: 3 (limit: 9484)
     Memory: 2.7M
        CPU: 9ms
     CGroup: /system.slice/nginx.service
             ??3977 "nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf"
             ??3978 "nginx: worker process"
             ??3979 "nginx: worker process"

Mar 02 12:53:57 opensearch systemd[1]: Starting nginx.service - nginx - high performance web server...
Mar 02 12:53:57 opensearch systemd[1]: Started nginx.service - nginx - high performance web server.

ステップ12 - SSLのインストール

SSL証明書を生成するためにCertbotをインストールする必要があります。Debianのリポジトリを使用してCertbotをインストールするか、Snapdツールを使用して最新バージョンを取得できます。Snapdバージョンを使用します。

Debian 12にはSnapdがインストールされていません。Snapdパッケージをインストールします。

$ sudo apt install snapd

次のコマンドを実行して、Snapdのバージョンが最新であることを確認します。

$ sudo snap install core && sudo snap refresh core

Certbotをインストールします。

$ sudo snap install --classic certbot

次のコマンドを使用して、Certbotコマンドが/usr/binディレクトリで実行できるようにシンボリックリンクを作成します。

$ sudo ln -s /snap/bin/certbot /usr/bin/certbot

Certbotが正しく機能しているか確認します。

$ certbot --version
certbot 2.9.0

次のコマンドを実行してSSL証明書を生成します。

$ sudo certbot certonly --nginx --agree-tos --no-eff-email --staple-ocsp --preferred-challenges http -m [email protected] -d craftcms.example.com

上記のコマンドは、サーバーの/etc/letsencrypt/live/craftcms.example.comディレクトリに証明書をダウンロードします。

Diffie-Hellmanグループ証明書を生成します。

$ sudo openssl dhparam -dsaparam -out /etc/ssl/certs/dhparam.pem 4096

Certbotの更新スケジューラーサービスを確認します。

$ sudo systemctl list-timers

next.certbot.renew.serviceがスケジュールされたサービスの1つとして表示されます。

NEXT                        LEFT           LAST                        PASSED    UNIT                         ACTIVATES                   ---------------------------------------------------------------------------------------------------------------------------------------  
Sat 2024-03-02 16:25:00 UTC 3h 27min left  -                           -         snap.certbot.renew.timer     snap.certbot.renew.service
Sat 2024-03-02 23:00:51 UTC 10h left       Sat 2024-03-02 06:29:02 UTC 6h ago    apt-daily.timer              apt-daily.service
Sun 2024-03-03 00:00:00 UTC 11h left       -                           -         dpkg-db-backup.timer         dpkg-db-backup.service
.....

プロセスのドライランを実行して、SSL更新が正常に機能しているか確認します。

$ sudo certbot renew --dry-run

エラーが表示されなければ、すべて設定完了です。証明書は自動的に更新されます。

ステップ13 - Nginxの設定

/etc/nginx/nginx.confファイルを編集のために開きます。

$ sudo nano /etc/nginx/nginx.conf

次の行をinclude /etc/nginx/conf.d/*.conf;の前に追加します。

server_names_hash_bucket_size 64;

ファイルを保存するには、Ctrl + Xを押し、プロンプトが表示されたらYを入力します。

/etc/nginx/conf.d/opensearch.confファイルを作成して開きます。

$ sudo nano /etc/nginx/conf.d/opensearch.conf

次のコードを貼り付けます。opensearch.example.comをあなたのドメイン名に置き換えます。

server {

    listen 443 ssl;
    listen [::]:443 ssl;

    http2 on;
    http3 on;
    quic_retry on;

    server_name opensearch.example.com;

    access_log  /var/log/nginx/opensearch.access.log;
    error_log   /var/log/nginx/opensearch.error.log;

    ssl_certificate      /etc/letsencrypt/live/opensearch.example.com/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/opensearch.example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/opensearch.example.com/chain.pem;

    ssl_session_timeout  5m;
    ssl_session_cache shared:MozSSL:10m;
    ssl_session_tickets off;
    ssl_early_data on;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
    ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_dhparam /etc/ssl/certs/dhparam.pem;

    location / {
        proxy_pass http://localhost:5601;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
# enforce HTTPS
server {
    listen 80;
    listen [::]:80;
    server_name  opensearch.example.com;
    return 301   https://$host$request_uri;
}

ファイルを保存するには、Ctrl + Xを押し、プロンプトが表示されたらYを入力します。

Nginxの設定を確認します。

$ sudo nginx -t

Nginxサーバーを再起動します。

$ sudo systemctl restart nginx

ブラウザでhttps://opensearch.example.comにアクセスしてOpenSearch Dashboardsを起動します。

ステップ14 - OpenSearch Dashboardsにアクセスして使用する

Nginxを使用した場合、https://opensearch.example.comまたはhttp://opensearch.example.com:5601のURLを介してダッシュボードにアクセスし、ログインページが表示されるはずです。

OpenSearch Dashboards Login Credentials

OpenSearchのために設定したカスタム管理者パスワードを入力し、ログインボタンをクリックして続行します。

OpenSearch Dashboards Add Data Page

データを追加ボタンをクリックして直接データを追加するか、最初にブラウズしたい場合は自分で探索リンクをクリックします。最初にブラウズすると、OpenSearch Dashboardsのダークモードに関するポップアップが表示されます。

OpenSearch Dashboards Theme Popup

閉じるボタンをクリックして続行します。次に、テナントを選択するように求められます。

OpenSearch Dashboards Tenant Selection screen

OpenSearch Dashboardsのテナントは、インデックスパターン、ビジュアライゼーション、ダッシュボード、および他のOpenSearch Dashboardsオブジェクトを保存するためのスペースです。各ユーザーは、複数の用途のために複数のテナントを作成できます。テナントは、他のOpenSearch Dashboardsユーザーと作業を安全に共有するために便利です。OpenSearchは、3つのオプションから選択するオプションを提供します。

  • グローバル - このテナントはすべてのOpenSearch Dashboardsユーザー間で共有されます。
  • プライベート - このテナントは各ユーザーに独占的で、共有できません。
  • カスタム - 管理者はカスタムテナントを作成し、特定のロールに割り当てることができます。作成後、これらのテナントを使用して特定のユーザーセットにスペースを提供できます。

今のところ、プライベートテナントのデフォルトオプションを選択します。確認ボタンをクリックして続行します。次のページが表示されます。

OpenSearch Dashboards Homepage

次に、OpenSearchとOpenSearch Dashboardsの接続を確認します。

右上のDev Toolsボタンをクリックすると、OpenSearch DashboardsのコンソールUIに関するミニポップアップが表示されます。

OpenSearch Dashboards Dev Tools Console Popup

閉じるボタンをクリックし、左側のコンソールにGET /というクエリを入力し、中央の小さな再生ボタンをクリックします。次のような出力が表示されるはずです。

OpenSearch Dashboards Console Connection Verification

これにより、OpenSearch DashboardsがOpenSearchからデータを受信しており、両者が正常に動作していることが確認されます。ここからデータを追加し始めることができます。

結論

これで、Debian 12サーバーにOpenSearchをインストールするチュートリアルが終了します。質問がある場合は、下のコメントに投稿してください。

Share: X/Twitter LinkedIn

新しい投稿を受信箱で受け取る

スパムはありません。いつでも購読を解除できます。