DEV Community

Lisa Jung
Lisa Jung

Posted on • Updated on

Beginner's guide to running Elasticsearch and Kibana v8+ Locally (macOS/Linux and Windows)

As of 8.0, Elastic Stack security is on by default for self-managed clusters!

When you download and run Elasticsearch and Kibana v8+ for the first time, you will notice that credentials for the elastic superuser and a unique enrollment token are automatically generated for you.

This blog will walk you through:

  1. using the enrollment token to configure Kibana and connect Kibana to Elasticsearch
  2. logging in as a superuser to start using your new secure deployment.

Resources

Download pages for Elasticsearch and Kibana

The directions for running Elasticsearch and Kibana using macOS/Linux and Windows are slightly different and are linked below for your convenience!

If you want more in depth overview of Elasticsearch and Kibana, check out my blog on Beginner's Crash Course to Elastic Stack Series.

For macOS and Linux

Elasticsearch

Step 1: Download Elasticsearch

Go to the Elasticsearch download page.

Choose the appropriate platform (green box) and click on the download option (orange box) for Elasticsearch.

Image description

Elasticsearch will begin to download (red box).

Image description

Step 2: Unzip Elasticsearch

For this tutorial, I dragged and dropped Elasticsearch to my desktop.

Go to the desktop and unzip Elasticsearch by double clicking on it (blue box).

Image description

Once Elasticsearch is unzipped, you will see a blue folder named elasticsearch-version # on your desktop.

Image description

Step 3: Start Elasticsearch

Using the command line, we will cd into the unzipped Elasticsearch folder on the desktop and start Elasticsearch!

Open a terminal of your choice. From your home directory, cd into the Desktop by executing the following command.

# In the terminal of your choice 
cd Desktop
Enter fullscreen mode Exit fullscreen mode

Change into the unzipped Elasticsearch directory by executing the following command.

#In the terminal
cd elasticsearch-8.5.2
Enter fullscreen mode Exit fullscreen mode

You will see that you are now in the elasticsearch directory (orange box).

Image description

Heads up
At the time of this blog creation, the latest version of Elasticsearch was 8.5.2 (yellow box).

Note that by the time you come across this blog, a newer version of Elasticsearch may have been released. Therefore, your Elasticsearch directory may reflect a different version number. Make sure to cd into the correct directory.

In the terminal, execute the following command to start Elasticsearch.

# In the terminal
bin/elasticsearch
Enter fullscreen mode Exit fullscreen mode

You will see the cursor blinking for a while before Elasticsearch starts running!

Image description

Keep this terminal open to continue running Elasticsearch for the rest of the tutorial.

Step 4: Find and save the credentials for Elasticsearch and Kibana

In the same terminal, either scroll down to the end or use "command + f" to find the term password.

Image description

Save the generated password for the elastic user and the enrollment token for Kibana in a secure location. These values are shown only once when you start Elasticsearch for the first time.

Also, note that the enrollment token for Kibana is only valid for the next 30 min!

Kibana

Next, we will download Kibana. Using the enrollment token, we will configure Kibana and connect it to Elasticsearch.

Step 1: Download Kibana

Go to the Kibana download page.

Choose the appropriate platform (green box) and click on the download button (orange) for Kibana.

Image description

Kibana will begin to download (red box).

Image description

Step 2: Unzip Kibana

For this tutorial, I dragged and dropped Kibana to my desktop.

Go to the desktop and unzip Kibana by double clicking on it (blue box).

Image description

Once Kibana is unzipped, you will see a blue folder named kibana-version # on your desktop.

Image description

Step 3: Start Kibana

By using the command line, we will cd into the unzipped Kibana directory on the desktop and start Kibana!

Open a new tab in your terminal. From your home directory, execute the following command to cd into to the Desktop.

# In a new tab of the terminal
cd Desktop
Enter fullscreen mode Exit fullscreen mode

Change into the unzipped Kibana directory by executing the following command.

# In the terminal
cd kibana-8.5.2
Enter fullscreen mode Exit fullscreen mode

You will see that you are now in the Kibana directory (orange box).

Image description

Heads up
At the time of this blog creation, the latest version of Kibana was 8.5.2.

Note that by the time you come across this blog, a newer version of Kibana may have been released. Therefore, your Kibana directory may reflect a different version number. Make sure to cd into the correct directory!

In the terminal, execute the following command start Kibana.

# In the terminal
bin/kibana 
Enter fullscreen mode Exit fullscreen mode

You will see the cursor blinking for a while before Kibana starts running!

When you look at the log, you will see the message "Kibana has not been configured" and it will point to a URL that will help you configure Kibana and connect it to Elasticsearch (red box).

Image description

Copy and paste the URL (red box) into a browser and hit enter.

You will see the following page.

Image description

Paste the enrollment token you had saved earlier and click on the "Configure Elastic" option (blue button).

Kibana will automatically set up everything and will connect over TLS to Elasticsearch.

Image description

When the set up completes, it will display the login page.

Image description

Use the username "elastic" and enter the unique password you had saved from the Elasticsearch section.

When you log in, you will see the following page. Click on the "Explore on my own" option (pink box).

Image description

It will take you to the Kibana home page. You are now ready to start using your new secure deployment!

Image description

Step 4: Start exploring what you can do with Elasticsearch and Kibana

The step by step guide is covered in my Beginner's Crash Course to Elastic Stack Series.

Part 1
This workshop will show you how you can perform CRUD (Create, Read, Update, and Delete) operations with Elasticsearch and Kibana.

Part 1 GitHub repo contains:

  • the video recording of the workshop. Timestamp 25:03 will take you directly to the CRUD operations section.
  • the requests needed to perform CRUD operations with Elasticsearch and Kibana.

Part 2
This workshop will show you how you can send search queries from Kibana to Elasticsearch and how you can fine-tune the relevance of your search results.

Part 2 GitHub repo contains the video recording of this workshops as well as all the queries and aggregations requests covered during the workshop.

Check out the following links to explore these topics after setting up Elasticsearch and Kibana:

There you have it. Now, go explore what you can do!

image

For Windows

Elasticsearch

Step 1: Download Elasticsearch

Go to the Elasticsearch download page.

Choose the appropriate platform (green box) and click on the download option (orange box) for Elasticsearch.

Image description

Elasticsearch will begin to download (red box).

Image description

Step 2: Unzip Elasticsearch

For this tutorial, I dragged and dropped Elasticsearch to my desktop.

Image description

Right click on the Elasticsearch directory to display a drop down menu and select the "Extract All" option (red box) .

Image description

Click on the "Extract" option (blue box).

Image description

Once extraction is complete, you will see a pop up window with an unzipped elasticsearch directory (orange box).

Image description

Right click on it to display the drop down menu and click on the "Open in Terminal" option (green box).

You will see the Elasticsearch directory open in your terminal.

Image description

In the terminal, execute the following command to start Elasticsearch.

bin\elasticsearch.bat
Enter fullscreen mode Exit fullscreen mode

You will see the cursor blinking for a while before Elasticsearch starts running!

Image description

Keep this terminal open to continue running Elasticsearch for the rest of the tutorial.

Step 4: Find and save the credentials for Elasticsearch and Kibana

In the same terminal, scroll down to the end and you will see the password and enrollment token displayed.

Image description

Save the generated password for the elastic user and the enrollment token for Kibana in a secure location. These values are shown only once when you start Elasticsearch for the first time.

Also, note that the enrollment token for Kibana is only valid for the next 30 min!

Kibana

Next, we will download Kibana. Using the enrollment token, we will configure Kibana and connect it to Elasticsearch.

Step 1: Download Kibana

Go to the Kibana download page.

Choose the appropriate platform (green box) and click on the download button (orange) for Kibana.

Image description

Kibana will begin to download (red box).

Image description

Step 2: Unzip Kibana

For this tutorial, I dragged and dropped Kibana to my desktop.

Right click on the Kibana directory to display the drop down menu and select the "Extract All" option (red box) .

Image description

Click on the "Extract" option (blue box).

Image description

Step 3: Start Kibana

Once the extraction is complete, you will see a pop up window with an unzipped Kibana directory (orange box).

Image description

Right click on it to display the drop down menu and click on "Open in Terminal" option (green box).

You will see the terminal open on your screen.

In the terminal, execute the following command to start Kibana.

bin\kibana.bat
Enter fullscreen mode Exit fullscreen mode

You will see the cursor blinking for a while before Kibana starts running!

When you look at the log, you will see the message "Kibana has not been configured" and it will point to a URL that will help you configure Kibana and connect it to Elasticsearch (red box).

Image description

Copy and paste the URL (red box) into a browser and hit enter.

You will see the following page.

Image description

Paste the enrollment token you had saved from Elasticsearch section and click on the "Configure Elastic" option (blue button).

Kibana will automatically set up everything and will connect over TLS to Elasticsearch.

Image description

When the set up completes, it will display the login page.

Image description

Use the username "elastic" and enter the unique password you saved from the Elasticsearch step.

When you log in, you will see the following page. Click on the "Explore on my own" option (pink box).

Image description

It will take you to the Kibana home page. You are now ready to start using your new secure deployment!

Image description

Step 4: Start exploring what you can do with Elasticsearch and Kibana

The step by step guide is covered in my Beginner's Crash Course to Elastic Stack Series.

Part 1
This workshop will show you how you can perform CRUD(Create, Read, Update, and Delete) operations with Elasticsearch and Kibana.

Part 1 GitHub repo contains:

  • the video recording of the workshop. Timestamp 25:03 will take you directly to the CRUD operations section.
  • the requests needed to perform CRUD operations with Elasticsearch and Kibana.

Part 2
This workshop will show you how you can send search queries from Kibana to Elasticsearch and how you can fine-tune the relevance of your search results.

Part 2 GitHub repo contains the video recording of this workshops as well as all the queries and aggregations requests covered during the workshop.

Check out the following links to explore these topics after setting up Elasticsearch and Kibana:

There you have it. Now, go explore what you can do!

image

Top comments (1)

Collapse
 
xvarze profile image
Xcalco Varze

I have a question. How to get back to the kibana generated localhost link ? like if i have to turn of my computer, how do i log back ino the site when i come back??