Beginner's guide to running Elasticsearch and Kibana v8+ Locally (macOS/Linux and Windows)
Published: 2022-11-30 16:29:50

As of 8.0, Elastic Stack [security is on by default](https://www.elastic.co/blog/introducing-simplified-elastic-stack-security) for self-managed clusters! 

![](https://media.giphy.com/media/xUjSOWCndCdECCyOEY/giphy.gif)

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
* [Elasticsearch](https://www.elastic.co/downloads/elasticsearch)
* [Kibana](https://www.elastic.co/downloads/kibana)

The directions for running Elasticsearch and Kibana using macOS/Linux and Windows are slightly different and are linked below for your convenience!  
- [macOS and Linux](#for-macOS-and-linux)
- [Windows](#for-windows)

If you want more in depth overview of Elasticsearch and Kibana, check out my blog on [Beginner's Crash Course to Elastic Stack Series](https://www.youtube.com/watch?v=gS_nHTWZEJ8&list=PL_mJOmq4zsHZYAyK606y7wjQtC0aoE6Es). 

## For macOS and Linux

### Elasticsearch ###
**Step 1: Download Elasticsearch**

Go to the [Elasticsearch download page](https://www.elastic.co/downloads/elasticsearch). 

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4m998bkd91spha8v7mi.png)

Elasticsearch will begin to download (red box).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ueddemedsbfr0hxmk8lt.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9liosxj9yfe7jrlwpm3.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hlgn2qt0gzwhtna9g459.png)

**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.
```javascript
# In the terminal of your choice 
cd Desktop
```
Change into the unzipped Elasticsearch directory by executing the following command.
```javascript
#In the terminal
cd elasticsearch-8.5.2
```
You will see that you are now in the elasticsearch directory (orange box).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7joz9he8l4wtcg1hra7p.png)

**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.

```javascript
# In the terminal
bin/elasticsearch
```
You will see the cursor blinking for a while before Elasticsearch starts running!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0hvdezc1nm42d4toixba.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wd9ft1oryo1ajsmt1aej.png)

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](https://www.elastic.co/downloads/kibana).

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03zc593jjeofxipwmqj6.png)

Kibana will begin to download (red box).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3e0ley0tmjfrk8c9dv37.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zjxrtan89wudumipsqyo.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y0aqb8kmbtmojx31x3cr.png)

**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.
```javascript
# In a new tab of the terminal
cd Desktop
```
Change into the unzipped Kibana directory by executing the following command.

```javascript
# In the terminal
cd kibana-8.5.2
```
You will see that you are now in the Kibana directory (orange box).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w6u9pjk8te4gibzxjpl0.png)

**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.
```javascript
# In the terminal
bin/kibana 
```
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nmu0f5rx6pq47luzoscx.png)

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

You will see the following page.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ybh1s49k0gc6tvro2jft.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vagganx309xu5wjwht6e.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hcq4g4p0nforj73zo7jb.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pmx6kwbqd4259eql9112.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1uapan71j53kf0fnvekn.png)

**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](https://www.youtube.com/watch?v=gS_nHTWZEJ8&list=PL_mJOmq4zsHZYAyK606y7wjQtC0aoE6Es). 

*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](https://github.com/LisaHJung/Part-1-Intro-to-Elasticsearch-and-Kibana/blob/main/README.md) 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](https://github.com/LisaHJung/Part-2-Understanding-the-relevance-of-your-search-with-Elasticsearch-and-Kibana-) 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: 
- [How to add data into Elasticsearch](https://youtu.be/CCTgroOcyfM?t=1138)
- [Queries and Aggregations used for search](https://youtu.be/CCTgroOcyfM?t=1317)​
- [Queries used to fine-tune Precision or Recall](https://youtu.be/CCTgroOcyfM?t=2013)

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

![image](https://media.giphy.com/media/CjmvTCZf2U3p09Cn0h/giphy.gif)

## For Windows 
### Elasticsearch ###
**Step 1: Download Elasticsearch**

Go to the [Elasticsearch download page](https://www.elastic.co/downloads/elasticsearch).

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2bibyemsqiwwt9chh0w1.png)

Elasticsearch will begin to download (red box).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ofpuydbiyfubum1h3hyv.png)

**Step 2: Unzip Elasticsearch**

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aeyy9k64ctfsw6l2cda7.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7i956e50avfig0dgxodg.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hxjatosoz9gkd83vghro.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3tdc21mm1anc4bh2751d.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nngc5m6b3xo3clnujhgr.png)

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

```javascript
bin\elasticsearch.bat
```
You will see the cursor blinking for a while before Elasticsearch starts running!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rctr21fyop76tscfix3e.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/855u3tl5jk1epq98bfku.png)

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](https://www.elastic.co/downloads/kibana).

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3lgzkkdhisseo38fqx0.png)

Kibana will begin to download (red box).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g28meguba9ochl8asl1h.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vixf8kf1kszdiko228yq.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kwz6qy8er89e2jrfgqgt.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/atlfwolvikw91j134j2p.png)

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. 
```javascript
bin\kibana.bat
```
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cqdbneh0ji0e8zgvlvru.png)

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

You will see the following page.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ur7mha7trfm22o7o4ga.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gq4ku60av3dxwqekgriw.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hcq4g4p0nforj73zo7jb.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pmx6kwbqd4259eql9112.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1uapan71j53kf0fnvekn.png)

**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](https://www.youtube.com/watch?v=gS_nHTWZEJ8&list=PL_mJOmq4zsHZYAyK606y7wjQtC0aoE6Es). 

*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](https://github.com/LisaHJung/Part-1-Intro-to-Elasticsearch-and-Kibana/blob/main/README.md) 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](https://github.com/LisaHJung/Part-2-Understanding-the-relevance-of-your-search-with-Elasticsearch-and-Kibana-) 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: 
- [How to add data into Elasticsearch](https://youtu.be/CCTgroOcyfM?t=1138)
- [Queries and Aggregations used for search](https://youtu.be/CCTgroOcyfM?t=1317)​
- [Queries used to fine-tune Precision or Recall](https://youtu.be/CCTgroOcyfM?t=2013)

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

![image](https://media.giphy.com/media/CjmvTCZf2U3p09Cn0h/giphy.gif)