Elastic and Kibana Install (Windows)

This goes through the steps to set up a single node Elasticsearch cluster and an instance of Kibana.

If you are setting up a production environment, then you will want to set up an Elasticsearch cluster. More information on this can be found on the Elasticsearch website.

Prerequisites
  • Download the correct version of Elasticsearch and Kibana for the version of Aiimi Insight Engine that you are deploying. This will be in the release notes for your distribution.

  • Obtain your XPack Elasticsearch licence (or you can enable the trial).

  • Download NSSM to run Kibana as a service.

Prerequisites


Folder Structure Set Up

A specific folder structure is needed for the installation of Elasticsearch and Kibana. You can create this structure manually or using a PowerShell query.

PowerShell

mkdir C:\Apps;
mkdir C:\InsightMaker;
mkdir Text input;
mkdir C:\Utils

Manual


Download Software

Start-BitsTransfer -Source "https://nssm.cc/release/nssm-2.24.zip" -destination "Text input";
Start-BitsTransfer -Source "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.4.9/npp.8.4.9.Installer.x64.exe" -destination "Text input";
Start-BitsTransfer -Source "https://www.7-zip.org/a/7z2201-x64.exe" -destination "Text input";
Start-BitsTransfer -Source "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.14.3-windows-x86_64.zip" -destination "Text input";
Start-BitsTransfer -Source "https://artifacts.elastic.co/downloads/kibana/kibana-8.14.3-windows-x86_64.zip" -destination "Text input"

Extract Software

Next the Elastic, Kibana, nssm and Insightmaker zip files need to be extracted.

PowerShell

Expand-Archive -Force Text input\elasticsearch-8.14.3-windows-x86_64.zip C:\Apps;
Expand-Archive -Force Text input\Kibana-8.14.3-windows-x86_64.zip C:\Apps;
Expand-Archive -Force Text input\nssm-2.24.zip C:\Utils;
Expand-Archive -Force Text input\insightmaker-windows.zip C:\Insightmaker

Manual


Elastic Configuration

$Filename = "C:\Apps\elasticsearch-8.14.3\config\elasticsearch.yml";
((Get-Content -path $Filename -Raw) -replace '#cluster.name: my-application','cluster.name: Text input') | Set-Content -Path $Filename;
((Get-Content -path $Filename -Raw) -replace '#node.name:','node.name:') | Set-Content -Path $Filename;
((Get-Content -path $Filename -Raw) -replace '#path.data: /path/to/data','path.data: C:\Apps\Data') | Set-Content -Path $Filename;
((Get-Content -path $Filename  -Raw) -replace '#path.logs: /path/to/logs','path.logs: C:\tmp\logs') | Set-Content -Path $Filename;
((Get-Content -path $Filename -Raw) -replace '#network.host: 192.168.0.1','network.host: 0.0.0.0') | Set-Content -Path $Filename;
((Get-Content -path $Filename -Raw) -replace '#discovery.seed_hosts:','discovery.seed_hosts:') | Set-Content -Path $Filename;
((Get-Content -path $Filename -Raw) -replace 'host1','0.0.0.0') | Set-Content -Path $Filename;
((Get-Content -path $Filename -Raw) -replace ', "host2"','') | Set-Content -Path $Filename;
((Get-Content -path $Filename -Raw) -replace '#cluster.initial_master_nodes:','cluster.initial_master_nodes:') | Set-Content -Path $Filename;
((Get-Content -path $Filename -Raw) -replace ', "node-2"]',']')  | Set-Content -Path $Filename

Install Elastic

Elastic needs to be installed as a service and this can be done with a PowerShell script.

cd C:\Apps\elasticsearch-8.14.3;
.\bin\elasticsearch.bat 

Install Kibana

cd C:\Apps\kibana-8.14.3\bin;
.\kibana.bat

Update Elastic License


Create Elastic Certificate

cd C:\Apps\elasticsearch-8.14.3\bin;
.\elasticsearch-certutil ca
./elasticsearch-certutil cert -ca C:\Apps\elasticsearch-8.14.3\elastic-stack-ca.p12;

Copy Certificates

You need to create a new certs folder and copy the certs to that folder.

mkdir C:\Apps\elasticsearch-8.14.3\config\certs;
mkdir C:\Apps\certs;

copy-item C:\Apps\elasticsearch-8.14.3\*.p12 -Destination C:\Apps\certs

move C:\Apps\elasticsearch-8.14.3\*.p12 C:\Apps\elasticsearch-8.14.3\config\certs

Elastic SSL Configuration

There are a number of configurations that need to be changed to add xpack security.

$Filename="C:\Apps\elasticsearch-8.14.3\config\elasticsearch.yml";

((Get-Content -path $Filename -Raw) -replace 'http.p12','elastic-certificates.p12') | Set-Content -Path $Filename

((Get-Content -path $Filename -Raw) -replace 'transport.p12','elastic-certificates.p12') | Set-Content -Path $Filename;

((Get-Content -path $Filename -Raw) -replace '#action.destructive_requires_name: false','action.destructive_requires_name: true') | Set-Content -Path $Filename;

(Get-Content -path $Filename) | ? {$_.trim() -ne "" } | set-content $Filename

Elastic Keystore Setup

Run the following scripts one by one.

cd C:\Apps\elasticsearch-8.14.3\bin;
.\elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password
.\elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password
.\elasticsearch-keystore add xpack.security.http.ssl.keystore.secure_password
.\elasticsearch-keystore add xpack.security.http.ssl.truststore.secure_password

Kibana SSL Configuration

$Filename="C:\Apps\Kibana-8.14.3\config\kibana.yml";

((Get-Content -path $Filename -Raw) -replace '#elasticsearch.ssl.verificationMode: full','elasticsearch.ssl.verificationMode: none') | Set-Content -Path $Filename

Install Elastic Service

C:\Apps\elasticsearch-8.14.3\bin\elasticsearch-service.bat install
C:\Apps\elasticsearch-8.14.3\bin\elasticsearch-service.bat start

Install Kibana Service

C:\Utils\nssm-2.24\win64\nssm.exe install insightmakerkibana
C:\Utils\nssm-2.24\win64\nssm.exe start "insightmakerkibana"

Last updated