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
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
Check the storage locations in the script before running it.
mkdir C:\Apps;
mkdir C:\InsightMaker;
mkdir Text input;
mkdir C:\Utils
Manual
Download Software
Check the versions and storage locations in the script before running it.
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
Check the version and storage location before running this script.
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
Check the version and storage location before running this script.
$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.
Check the versions and storage locations before running this script.
cd C:\Apps\elasticsearch-8.14.3;
.\bin\elasticsearch.bat

Install Kibana
Check the version and storage location before running this script.
cd C:\Apps\kibana-8.14.3\bin;
.\kibana.bat
Update Elastic License

Create Elastic Certificate
Check the versions and storage locations before running these scripts.
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.
Check the versions and storage locations before running this script.
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.
Check the version and storage location before running this script.
$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.
Check the versions and storage locations before running these scripts.
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
Check the versions and storage locations before running these scripts.
$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
Check the versions and storage locations before running these scripts.
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
Check the versions and storage locations before running these scripts.
C:\Utils\nssm-2.24\win64\nssm.exe install insightmakerkibana
C:\Utils\nssm-2.24\win64\nssm.exe start "insightmakerkibana"
Last updated