DEV Community

Lisa Jung for Elastic

Posted on • Updated on

Running Elasticsearch and Kibana v7+ (macOS/Linux and Windows)

Heads up!
If you are looking to run Elasticsearch and Kibana v8+ locally, the process will be different from the one shown in this blog. Check out the blog for running v8+ here!

Elastic Stack consists of Elasticsearch, Kibana, Beats, and Logstash.

Together, the Elastic Stack allows you to take data from any source, in any format, then search, analyze, and visualize it in real time.

Since the beginning, Elastic Stack has been free and open!

This blog will walk you through how you can download and run Elasticsearch and Kibana locally on Linux, macOS, or Windows.

The following links will take you to the download pages for Elasticsearch and Kibana.

The directions for macOS/Linux and Windows are slightly different. Directions for these operatings systems are shown below.

If you want more in depth overview of Elasticsearch and Kibana, check out my blog on Beginner's guide to Elasticsearch.

For macOS and Linux

Elasticsearch

Step 1: Download Elasticsearch

Go to the Elasticsearch download link.

Select the download option for your operating system(green box).

Download ES

Step 2: Relocate the downloaded Elasticsearch and extract it

Where you relocate Elasticsearch is up to you but for this tutorial, I am moving it to the desktop.

Once Elasticsearch is downloaded(orange box), control-click on Elasticsearch and click on show in folder.

Relocate the file

Select Elasticsearch(orange box) and move it to the desktop(green box).

Move to download

Go to the desktop and unzip Elasticsearch by double clicking on it(orange box). Once Elasticsearch is unzipped, you will see a blue folder named Elasticsearch on your desktop.

Unzip the file

Step 3: Start the Elasticsearch server and ensure that everything is working properly

By using the command line, we will locate the unzipped Elasticsearch folder in the desktop and run the Elasticsearch server!

Open up a terminal of your choice. From your home directory, copy and paste the following command into your terminal to get to the Desktop.



# In the terminal of your choice 
cd Desktop


Enter fullscreen mode Exit fullscreen mode

Run the ls command in your terminal to check the name of your unzipped Elasticsearch folder(orange box) located in your Desktop.



# In the terminal
ls


Enter fullscreen mode Exit fullscreen mode

Find ES on Desktop (2)

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



# In the terminal
# A new version of Elasticsearch may have been released by the time you download Elasticsearch. 
#Therefore, the version of your download may differ from what is shown below(7.10.0). 
#Please make sure you cd into the Elasticsearch directory shown when using the ls command from the previous step.  

cd elasticsearch-7.10.0


Enter fullscreen mode Exit fullscreen mode

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

CD into elasticsearch

In the terminal, run the following command.



# In the terminal
bin/elasticsearch


Enter fullscreen mode Exit fullscreen mode

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

Step 4: Send a cURL command to the Elasticsearch server to make sure that Elasticsearch is up and running

A REST API is used to send requests to the Elasticsearch server. These requests are sent to the endpoint http://localhost:9200.

We will use a cURL command to check whether the request is received by Elasticsearch server.

Open up a NEW terminal.

In the home directory of the new terminal, run the following command.



# In the new terminal
curl http://localhost:9200


Enter fullscreen mode Exit fullscreen mode

curl command

When you run the command(orange box), you will see the following JSON object displayed in your terminal(green box). If you see this JSON object, that means everything is working correctly and Elasticsearch has been successfully installed.

Leave these two terminals open to keep the Elasticsearch server running.

Kibana

Downloading Kibana is very similar to downloading Elasticsearch.

Step 1: Download Kibana

Kibana is a web interface for Elasticsearch. Kibana ships with its backend server that communicates with Elasticsearch.

Go to the Kibana download link.

In the region highlighted with a red box, select the download option for your operating system.

Alt Text

You will see that a zip file has been downloaded.

Step 2: Relocate the downloaded Kibana and extract it

Where you relocate Kibana is up to you but for this tutorial, I am moving it to the desktop.

Once Kibana is downloaded(orange box), control-click on Kibana and click on show in folder.
download Kibana

Select the downloaded Kibana(orange box) and move it to the desktop(green box).
relocate kibana

Go to the desktop and unzip Kibana by double clicking on it(orange box). Once Kibana is unzipped, you will see a blue folder named Kibana on your desktop.

unzip kibana

Step 3: Run Kibana and ensure that everything is working properly

By using the command line, we will locate the unzipped Kibana folder in the desktop and run the Kibana server!

Open up a new terminal. From your home directory, copy and paste the following command into your terminal to get to the Desktop.



# In a new terminal
cd Desktop


Enter fullscreen mode Exit fullscreen mode

Run the ls command in your terminal to check the name of your unzipped Kibana folder(orange box) located in your Desktop.



# In the terminal
ls


Enter fullscreen mode Exit fullscreen mode

cd into Kibana (1)

Change into the unzipped Kibana directory.



# In the terminal
# By the time you download Kibana, a new version of Kibana may have been released. 
# Therefore, the version of your download may differ from what is shown below(7.10.0-darwin-x86_64). 
# Please make sure you cd into the Kibana directory shown when using the ls command from the previous step.  

cd kibana-7.10.0-darwin-x86_64


Enter fullscreen mode Exit fullscreen mode

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

Kibana directory

In the terminal, run the following command.



# In the terminal
bin/kibana 


Enter fullscreen mode Exit fullscreen mode

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

Kibana running

When you see the following message that the Server is running at http://localhost:5601 in your terminal, you are ready to work with the Kibana interface.

Kibanna server running

Open up a browser and go to http://localhost:5601.

You will see the following displayed on the browser.

Alt Text

If Kibana does not load on your browser...



If you are having trouble getting Kibana to load, try restarting your Elasticsearch server. 
Go to the terminal used for your Elasticserach server. 
Press control + c. Then, run bin/elasticsearch in the same terminal. 

Go back to your terminal that is running Kibana. 
Run control + c in the command prompt terminal. 
Then, run bin/kibana in the terminal. Go to http://localhost:5601 on your browser. 


Enter fullscreen mode Exit fullscreen mode

All right let's get back to the Kibana browser.

Alt Text

Click on the menu option(red box) to display a drop down menu. Scroll down to management section and click on Dev Tools option(green box).

You will see the following interface here where you can send search queries to Elasticsearch!

Alt Text

Congrats. You have successfully downloaded and ran Elasticsearch and Kibana on your macOS/Linux!

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.
  • all 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 finetune 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.

The following timestamps mark the topics you may want to explore after setting up Elasticsearch and Kibana:

  • How to add data into Elasticsearch 18:58
  • Queries and Aggregations used for search 21:56​
  • Queries used to finetune Precision or Recall 33:33

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

image

For Windows

Elasticsearch

Step 1: Download Elasticsearch

Go to the Elasticsearch download link.

In the region highlighted with a green box, select the download option for Windows.

Alt Text

You will see that a zip folder has been downloaded(orange box).

Step 2: Relocate the downloaded Elasticsearch and extract it

Where you relocate this file is up to you but for this tutorial, I have created a folder called Elastic_Stack in my Windows(C:) drive.

Move the downloaded file to Elastic_Stack folder.

Alt Text

Right click on the folder to display pop up options and click on extract all option. Once the folder has been extracted, double click on the folder. You will see the following displayed on your screen.

Alt Text

Double click on the folder.

Alt Text

Click on bin folder(red box).

Alt Text

Click on the region highlighted with a green box. It should reveal the file path to the bin folder. Copy this address. We will be using it in the next step.

Step 3: Start the Elasticsearch server and ensure that everything is working properly

Alt Text

Search for the Command Prompt App in the search bar(purple box) and click on run as administrator option(red box).

In the Command Prompt App terminal, change into the bin directory(cd) by providing the file path to the bin folder. This is the file path you have copied in the previous step.



# In the command prompt terminal

cd filepath to bin folder in Elasticsearch


Enter fullscreen mode Exit fullscreen mode

Alt Text

Red box highlights the command we have used to change to the bin directory.

When you press enter, you will see that you have changed into the bin directory(blue box).

In the terminal, run the following command.



# In the command prompt terminal

elasticsearch.bat


Enter fullscreen mode Exit fullscreen mode

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

Alt Text

You will see that Elasticsearch server is running on localhost at port 9200(red box).

A REST API is used to send a request to the Elasticsearch server. The request is sent to the endpoint http://localhost:9200.

We will use a cURL command to check whether the request is received by Elasticsearch server.

Open up a new command prompt window(red box).

Alt Text

In the new terminal, run the following command.



# In new command prompt terminal

curl http://localhost:9200


Enter fullscreen mode Exit fullscreen mode

Alt Text

When you run the command(white box), you will see the following JSON object displayed in your terminal(blue box). That means everything is working correctly and Elasticsearch has been successfully installed.

Leave these terminals open to keep the Elasticsearch server running.

Kibana

Installing Kibana is very similar to installing Elasticsearch.

Step 1: Download Kibana

Kibana is a web interface for Elasticsearch. Kibana ships with its backend server that communicates with Elasticsearch.

Go to the Kibana download link.

In the region highlighted with a red box, select the download option for Windows.

Alt Text

You will see that a zip folder has been downloaded.

Step 2: Relocate the downloaded Kibana and extract it

Where you relocate this folder is up to you but for this tutorial, I have created a folder called Elastic_Stack in my Windows(C:) drive.

Move the downloaded folder to Elastic_Stack folder.
Alt Text

Right click on the folderto display options and click on extract all option. Once the folder has been extracted, double click on the folder.

Alt Text

Click on the bin folder(red box).

Alt Text

Click on the region highlighted with a green box. It should reveal the file path to the bin folder. Copy this address. We will be using it in the next step.

Step 3: Run Kibana and ensure that everything is working properly

First, go back to the command prompt window that is running the Elasticsearch server. Make sure it is still running and it is not displaying any error messages.

Open up a new command prompt window.

In the Command Prompt App terminal, change into the bin directory(cd) of Kibana by providing the file path to the bin folder. This is the path you have copied from the bin folder in the previous step.



# In the command prompt terminal

cd filepath to bin folder in Kibana 


Enter fullscreen mode Exit fullscreen mode

Alt Text

The command has been highlighted with a red box.

When you press enter, you will see that you have changed into the bin directory(blue box).

In the terminal, run the following command.



# In the command prompt terminal

kibana.bat


Enter fullscreen mode Exit fullscreen mode

You will see the cursor blinking for a while before you see Kibana running!
When you see the message http server running at http://localhost:5601 in your terminal, you are ready to work with the Kibana interface.

Alt Text

Open up a browser and go to http://localhost:5601.

You will see the following displayed on the browser.

Alt Text

If Kibana does not load on your browser...



If you are having trouble getting Kibana to load, try restarting your Elasticsearch server. 
Go to the terminal used for your Elasticserach server. 
Press control + c. Then, run elasticsearch.bat in the same terminal. 

Go back to your terminal that is running Kibana.
Run control + c in the command prompt terminal. 
Then, run kibana.bat in the terminal. 
Go to http://localhost:5601 on your browser. 


Enter fullscreen mode Exit fullscreen mode

All right let's get back to the Kibana browser.

Alt Text

Click on the menu option(red box) to display a drop down menu. Scroll down to management section and click on Dev Tools option(green box).

You will see the following interface here where you can send search queries to Elasticsearch!

Alt Text

Congrats. You have successfully downloaded and ran Elasticsearch and Kibana on Windows!

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.
  • all 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 finetune 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.

The following timestamps mark the topics you may want to explore after setting up Elasticsearch and Kibana:

  • How to add data into Elasticsearch 18:58
  • Queries and Aggregations used for search 21:56​
  • Queries used to finetune Precision or Recall 33:33

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

image

Top comments (12)

Collapse
 
itshamzaoffical profile image
Hamza Shabbir

For Version 8.5
Run elasticsearch-setup-passwords auto bofre running curl -k -u elastic localhost:9200 to get your passwords.

Collapse
 
hackvan profile image
Diego Camacho

Great post, very useful for the first steps.

BTW I love the "tagline" : "You Know, for Search" from the Elastic properties ;-)

Collapse
 
lisahjung profile image
Lisa Jung

Thank you so much Diego!! I love the tagline as well! :)

Collapse
 
abdovenom profile image
venom • Edited

1-i have this message:
Image description
2-when i write this command :
curl localhost:9200
3-and this when i run the kibana
Image description
@lisahjung

Collapse
 
informramc profile image
informramc

The Kibana download link (Under "For macOS and Linux") is pointing to Elastic Search download page. Please correct it

Collapse
 
lisahjung profile image
Lisa Jung

Hi @informramc! Thank you so much for catching that. Just made the edit. I appreciate ya! :)

Collapse
 
hajara profile image
Hajara Iyal

Hi Lisa, great post breaking everything down.

I'm having trouble after running the 'curl localhost:9200' command.

I get a response saying 'curl: (52) Empty reply from server'. I'm not sure why, I tried googling but didn't have much luck. I already ran CTRL F in my terminal tab to make sure that the 'bin/elasticsearch' command worked, and it did.

Any clue what I could try?

Collapse
 
lisahjung profile image
Lisa Jung

Hey @hajara!

Thank you so much for the wonderful comment and for reaching out.
This blog has some outdated information that I need to update!

This blog was created for version 7 of Elasticsearch.

"curl: (52) Empty reply from server" is a common error message you would encounter when you follow these directions with version 8+ of Elasticsearch.

With version 8, security is on by default. Therefore, the procedure for connecting to Elasticsearch has changed!

Let me walk you through this process.

When you run Elasticsearch by running "elasticsearch.bat", you will find the Elasticsearch log populating in your terminal as shown below.

Image description

When you scroll down or use "ctrl+f" to find the term password, you will see this page here that shows the password for the elastic user.

Copy the generated password and enrollment token and save them in a secure location. These values are shown only when you start Elasticsearch for the first time.

Image description

In a separate tab of your terminal, run curl -k -u elastic localhost:9200

It will prompt you to enter host password.

Image description

Paste the password and press enter.
When you see the following cluster information, it means that you are securely connected to Elasticsearch!

Image description

Then you will enroll Kibana with security enabled with the enrollment token you have saved from the previous step.

The steps on how to do that is shown here:
elastic.co/guide/en/elasticsearch/...

Scroll down to "Start Elasticsearch and enroll Kibana with security enabled" section.

Hope this helps!!

Collapse
 
shopiley profile image
Shopiley

Hello, port localhost:9200 asks for an authentication so when I enter in the new command prompt terminal, I get a security exception error. How do I go about this?

Collapse
 
lisahjung profile image
Lisa Jung • Edited

Hey @shopiley!

The blog that you were using was created for version 7 of Elasticsearch.

With version 8 which I assume you are working with now, security is on by default.

Therefore, the procedure for connecting to Elasticsearch has changed! (Time to update my blog!! )

If you are using Windows, please post this question on the discuss.elastic.co/

If you are a mac user, follow the instructions below. I wish I could add the screenshots in the comments but it's not working. The description should suffice though!

When you run Elasticsearch by running elasticsearch.bat, you will find the elasticsearch log populating in your terminal.

When you scroll down or use ctrl+F to find the term password, you will see the part of the log that shows the password for the elastic user. Copy the generated password and enrollment token and save them in a secure location. These values are shown only when you start Elasticsearch for the first time.

In a separate tab of your terminal, run curl -k -u elastic localhost:9200

It will prompt you to enter the host password.

Paste the password and press enter.
When you see the cluster information, it means that you are securely connected to Elasticsearch!

Then you will enroll Kibana with security enabled with the enrollment token you have saved from the previous step.

The steps on how to do that are shown here.
elastic.co/guide/en/elasticsearch/...

Scroll down to the "Start Elasticsearch and enroll Kibana with security enabled" section.

Hope this helps!!

Collapse
 
deeproy683 profile image
Deep Roy • Edited

please correct the link for kibana download. elastic.co/downloads/kibana

Collapse
 
lisahjung profile image
Lisa Jung

Hey @Deep Roy!
I checked all the links for Kibana download in my blog and it takes you to the right page. Did you have trouble accessing it?