Install Kibana as Windows Service Using Powershell

This guide installs Kibana as Windows service using Powershell.

Kibana:

Kibana is an open source data visualization plugin for Elasticsearch. It provides visualization capabilities on top of the content indexed on an Elasticsearch cluster. Users can create bar, line and scatter plots, or pie charts and maps on top of large volumes of data

Requirement:

  1. Elasticsearch

Steps executed in following powershell script:

  1. Download NSSM – the Non-Sucking Service Manager
    $webclient = New-Object System.Net.WebClient
    $url = "https://nssm.cc/release/nssm-2.24.zip"
    $file = "$pwd\nssm.zip"
    $webclient.DownloadFile($url,$file)
    
  2. Unzip NSSM zip file at some location
    $shell = new-object -com shell.application
    $zip = $shell.NameSpace("$pwd\nssm.zip")
    foreach($item in $zip.items())
    {
    $shell.Namespace("C:\").copyhere($item)
    }
  3. Add nssm.exe application path in Environment Variables
    $env:path +=';C:\nssm-2.24\win64'
  4. Download Kibana
    $webclient = New-Object System.Net.WebClient
    $url = "https://download.elastic.co/kibana/kibana/kibana-4.1.9-windows.zip"
    $file = "$pwd\kibana.zip"
    $webclient.DownloadFile($url,$file)
  5. Unzip Kibana zip file at some location
    $shell = new-object -com shell.application
    $zip = $shell.NameSpace("$pwd\kibana.zip")
    foreach($item in $zip.items())
    {
    $shell.Namespace("C:\").copyhere($item)
    }
  6. Run nssm command to install Kibana as Windows Service
    nssm.exe install "Kibana" "C:\kibana-4.1.9-windows\bin\kibana.bat"
  7. Start Kibana Service
    Start-Service "Kibana"
Create Powershell script file with following script in it.
# Downloding NSSM
Write-Host "Downloading NSSM ....."
$webclient = New-Object System.Net.WebClient
$url = "https://nssm.cc/release/nssm-2.24.zip"
$file = "$pwd\nssm.zip"
$webclient.DownloadFile($url,$file)
Write-Host "NSSM Download Completed ....."

# Unzip NSSM File
Write-Host "Unzip nssm file ....."
$shell = new-object -com shell.application
$zip = $shell.NameSpace("$pwd\nssm.zip")
foreach($item in $zip.items())
{
$shell.Namespace("C:\").copyhere($item)
}
Write-Host "NSSM Unzip Completed ....."

# Adding nssm application path in environment variable
Write-Host "Add nssm application path as environment variable"
$env:path +=';C:\nssm-2.24\win64'

# Downloding kibana
Write-Host "Downloading kibana 4.1.9 ....."
$webclient = New-Object System.Net.WebClient
$url = "https://download.elastic.co/kibana/kibana/kibana-4.1.9-windows.zip"
$file = "$pwd\kibana.zip"
$webclient.DownloadFile($url,$file)
Write-Host "Kibana Download Completed ....."

# Unzip Kibana File
Write-Host "Unzip kibana file ....."
$shell = new-object -com shell.application
$zip = $shell.NameSpace("$pwd\kibana.zip")
foreach($item in $zip.items())
{
$shell.Namespace("C:\").copyhere($item)
}
Write-Host "Kibana Unzip Completed ....."

# Create Kibana service
Write-Host "creating  kibana service....."
nssm.exe install "Kibana" "C:\kibana-4.1.9-windows\bin\kibana.bat"
Start-Sleep -s 10
Start-Service "Kibana"
Write-Host "created  kibana service....."  
Run following command in powershell:
powershell.exe -ExecutionPolicy Bypass -File [Script_File_Path]
If the service was started successfully, open a web browser and access admin page: http://localhost:5601 That is all about. Have fun!!! Thank you..

Comments

Popular posts from this blog

Sonarqube Integration with Visual Studio 2022 and VS Code

Run And Debug Test Cases Using Jest With Different CLI Options