Install Logstash on Ubuntu VM

Photo by Marc-Olivier Paquin on Unsplash

In this post, we will use vermin to install Elastic Logstash.

We will use vermin as it is a simple virtual machine program that uses Virtualbox as the underlying hypervisor.

To follow this tutorial, you will have to install vermin.

First, you need to install Virtualbox, then for Linux and macOS, in a terminal window:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mhewedy/vermin/master/install.sh)"

And for Windows, Open a PowerShell terminal as an administrator then use:

iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/mhewedy/vermin/master/install.ps1'))

We need the installation script (logstash.sh):

# install Java runtime:
sudo apt-get install default-jre -y
# install logstash:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https -y
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt-get update
sudo apt-get install logstash -y
# important in development when start the logstash process by the regular user
sudo chmod 777 /usr/share/logstash/data
# enable & start logstash service:
# keep comments in dev environment, so you can start logstash with differnt configurations parameters
# However, in production, you need to set the logstash service by uncommenting following lines:
#sudo systemctl enable logstash
#sudo systemctl start logstash

Then, you need to create a new Ubuntu VM using the installation script to provision the VM after creation:

$ vermin create ubuntu/focal logstash.sh

Now login to the VM and you can test Logstash by using the following command:

$ vermin ssh vm_03 # change to reflect the name in your case
$ /usr/share/logstash/bin/logstash -e 'input { stdin{} } output { stdout{} }'

The server will take some time to start. Now you can type any arbitrary text and see the result in the console after being processed by Logstash:

Software Developer/Architect

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store