skip to Main Content

So i was looking to install OpenSearch for my localhost Magento2 installation, but i could only find install methods for using Docker..

I’m not using Docker for a few reasons, that have to do with the company i’m at right now, but i would really like to just install OpenSearch on my own computer locally, and run it locally, not using other programs like Docker, is that even possible?

BTW; i’m on Ubuntu 22.04 and Magento 2.4.6 (if thats even important to know lol)

Thanks in advance!

2

Answers


  1. OpenSearch documentation provides at least a couple ways to install it without docker. I will list two of the methods below to avoid copy pasting whole documentation.

    Using tarball (aka download archive, extract it and run)

    Step 1: Download and unpack 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
    

    Extract the contents of the tarball.

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

    Step 2: Configure important system settings

    Disable memory paging and swapping performance on the host to improve performance.

    sudo swapoff -a
    

    Increase the number of memory maps available to 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
    

    Reload the kernel parameters using sysctl and verify that the change was applied by checking the value

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

    Step 3: Run OpenSearch

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

    From an APT repository

    Install the necessary packages.

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

    Import the public GPG key. This key is used to verify that the APT repository is signed.

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

    Create an APT repository for OpenSearch:

    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
    

    Verify that the repository was created successfully.

     sudo apt-get update
    

    With the repository information added, list all available versions of OpenSearch:

    sudo apt list -a opensearch
    

    Choose the version of OpenSearch you want to install:

    sudo apt-get install opensearch
    

    To install a specific version of OpenSearch:

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

    Once complete, enable OpenSearch.

     sudo systemctl enable opensearch
    

    Start OpenSearch.

     sudo systemctl start opensearch
     sudo systemctl status opensearch
    

    To verify that OpenSearch installed correctly.

    Send a request to port 9200:

    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" : "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/"
     }
    
    Login or Signup to reply.
  2. As Magento2 latest version supports the 2.5.0 version only, so I will be sharing the steps to install that from the APT repository directly. In this all the steps are copied from the official documentation:

    Install OpenSearch from an APT repository

    APT, the primary package management tool for Debian–based operating systems, allows you to download and install the Debian package from the APT repository.

    Step 1: Install the necessary packages.

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

    Step 2: Import the public GPG key. This key is used to verify that the APT repository is signed.

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

    Step 3: Create an APT repository for OpenSearch:

    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
    

    Step 4: Verify that the repository was created successfully.

     sudo apt-get update
    

    Step 5: With the repository information added, list all available versions of OpenSearch:

    sudo apt list -a opensearch
    

    Step 6: Choose the version of OpenSearch you want to install:

    Step 6.1 : Unless otherwise indicated, the latest available version of OpenSearch is installed.

    sudo apt-get install opensearch
    

    Step 6.2 : To install a specific version of OpenSearch:

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

    Once complete, enable OpenSearch.

     sudo systemctl enable opensearch
    

    Start OpenSearch.

     sudo systemctl start opensearch
    

    Verify that OpenSearch launched correctly.

     sudo systemctl status opensearch
    

    Test 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/"
     }
    

    Query the plugins endpoint:

     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
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search