Book Image

Kibana Essentials

Book Image

Kibana Essentials

Overview of this book

Table of Contents (15 chapters)
Kibana Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Prerequisites for installing Kibana 4.1.1


The following pieces of software need to be installed before installing Kibana 4.1.1:

  • Java 1.8u20+

  • Elasticsearch v1.4.4+

  • A modern web browser—IE 10+, Firefox, Chrome, Safari, and so on

The installation process will be covered separately for Windows and Ubuntu so that both types of users are able to understand the process of installation easily.

Installation of Java

In this section, JDK needs to be installed so as to access Elasticsearch. Oracle Java 8 (update 20 onwards) will be installed as it is the recommended version for Elasticsearch from version 1.4.4 onwards.

Installation of Java on Ubuntu 14.04

Install Java 8 using the terminal and the apt package in the following manner:

  1. Add the Oracle Java Personal Package Archive (PPA) to the apt repository list:

    sudo add-apt-repository -y ppa:webupd8team/java
    

    Note

    In this case, we use a third-party repository; however, the WebUpd8 team is trusted to install Java. It does not include any Java binaries. Instead, the PPA directly downloads from Oracle and installs it.

    As shown in the preceding screenshot, you will initially be prompted for the password for running the sudo command (only when you have not logged in as root), and on successful addition to the repository, you will receive an OK message, which means that the repository has been imported.

  2. Update the apt package database to include all the latest files under the packages:

    sudo apt-get update
    
  3. Install the latest version of Oracle Java 8:

    sudo apt-get -y install oracle-java8-installer
    

    Also, during the installation, you will be prompted to accept the license agreement, which pops up as follows:

  4. To check whether Java has been successfully installed, type the following command in the terminal:

    java –version
    

    This signifies that Java has been installed successfully.

Installation of Java on Windows

We can install Java on windows by going through the following steps:

  1. Download the latest version of the Java JDK from the Sun Microsystems site at http://www.oracle.com/technetwork/java/javase/downloads/index.html:

  2. As shown in the preceding screenshot, click on the DOWNLOAD button of JDK to download. You will be redirected to the download page. There, you have to first click on the Accept License Agreement radio button, followed by the Windows version to download the .exe file, as shown here:

  3. Double-click on the file to be installed and it will open as an installer.

  4. Click on Next, accept the license by reading it, and keep clicking on Next until it shows that JDK has been installed successfully.

  5. Now, to run Java on Windows, you need to set the path of JAVA in the environment variable settings of Windows. Firstly, open the properties of My Computer. Select the Advanced system settings and then click on the Advanced tab, wherein you have to click on the environment variables option, as shown in this screenshot:

    After opening Environment Variables, click on New (under the System variables) and give the variable name as JAVA_HOME and variable value as C:\Program Files\Java\jdk1.8.0_45 (do check in your system where jdk has been installed and provide the path corresponding to the version installed as mentioned in system directory), as shown in the following screenshot:

    Then, double-click on the Path variable (under the System variables) and move towards the end of textbox. Insert a semicolon if it is not already inserted, and add the location of the bin folder of JDK, like this: %JAVA_HOME%\bin. Next, click on OK in all the windows opened.

    Note

    Do not delete anything within the path variable textbox.

  6. To check whether Java is installed or not, type the following command in Command Prompt:

    java –version
    

    This signifies that Java has been installed successfully.

Installation of Elasticsearch

In this section, Elasticsearch, which is required to access Kibana, will be installed. Elasticsearch v1.5.2 will be installed, and this section covers the installation on Ubuntu and Windows separately.

Installation of Elasticsearch on Ubuntu 14.04

To install Elasticsearch on Ubuntu, perform the following steps:

  1. Download Elasticsearch v 1.5.2 as a .tar file using the following command on the terminal:

    curl -L -O https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.5.2.tar.gz
    

    Note

    Curl is a package that may not be installed on Ubuntu by the user. To use curl, you need to install the curl package, which can be done using the following command:

    sudo apt-get -y install curl
    
  2. Extract the downloaded .tar file using this command:

    tar -xvzf elasticsearch-1.5.2.tar.gz
    

    This will extract the files and folder into the current working directory.

  3. Navigate to the bin directory within the elasticsearch-1.5.2 directory:

    cd elasticsearch-1.5.2/bin
    
  4. Now run Elasticsearch to start the node and cluster, using the following command:

    ./elasticsearch
    

    The preceding screenshot shows that the Elasticsearch node has been started, and it has been given a random Marvel Comics character name.

    Note

    If this terminal is closed, Elasticsearch will stop running as this node will shut down. However, if you have multiple Elasticsearch nodes running, then shutting down a node will not result in shutting down Elasticsearch.

  5. To verify the Elasticsearch installation, open http://localhost:9200 in your browser.

Installation of Elasticsearch on Windows

The installation on Windows can be done by following similar steps as in the case of Ubuntu. To use curl commands on Windows, we will be installing GIT. GIT will also be used to import a sample JSON file into Elasticsearch using elasticdump, as described in the Importing a JSON file into Elasticsearch section.

Installation of GIT

To run curl commands on Windows, first download and install GIT, then perform the following steps:

  1. Download the GIT ZIP package from https://git-scm.com/download/win.

  2. Double-click on the downloaded file, which will walk you through the installation process.

  3. Keep clicking on Next by not changing the default options until the Finish button is clicked on.

  4. To validate the GIT installation, right-click on any folder in which you should be able to see the options of GIT, such as GIT Bash, as shown in the following screenshot:

The following are the steps required to install Elasticsearch on Windows:

  1. Open GIT Bash and enter the following command in the terminal:

    curl –L –O https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.5.2.zip
    
  2. Extract the downloaded ZIP package by either unzipping it using WinRar, 7Zip, and so on (if you don't have any of these, download one of them) or using the following command in GIT Bash:

    unzip elasticsearch-1.5.2.zip
    

    This will extract the files and folder into the directory.

  3. Then click on the extracted folder and navigate through it to reach the bin folder.

  4. Click on the elasticsearch.bat file to run Elasticsearch.

    The preceding screenshot shows that the Elasticsearch node has been started, and it is given a random Marvel Comics character's name.

    Note

    Again, if this window is closed, Elasticsearch will stop running as this node will shut down. However, if you have multiple Elasticsearch nodes running, then shutting down a node will not result in shutting down Elasticsearch.

  5. To verify the Elasticsearch installation, open http://localhost:9200 in your browser.

Installation of Kibana

In this section, Kibana will be installed. We will install Kibana v4.1.1, and this section covers installations on Ubuntu and Windows separately.

Installation of Kibana on Ubuntu 14.04

To install Kibana on Ubuntu, follow these steps:

  1. Download Kibana version 4.1.1 as a .tar file using the following command in the terminal:

    curl -L -O https://download.elasticsearch.org/kibana/kibana/kibana-4.1.1-linux-x64.tar.gz
    
  2. Extract the downloaded .tar file using this command:

    tar -xvzf kibana-4.1.1-linux-x64.tar.gz
    

    The preceding command will extract the files and folder into the current working directory.

  3. Navigate to the bin directory within the kibana-4.1.1-linux-x64 directory:

    cd kibana-4.1.1-linux-x64/bin
    
  4. Now run Kibana to start the node and cluster using the following command:

    ./kibana
    

    Note

    Make sure that Elasticsearch is running. If it is not running and you try to start Kibana, the following error will be displayed after you run the preceding command:

  5. To verify the Kibana installation, open http://localhost:5601 in your browser.

Installation of Kibana on Windows

To install Kibana on Windows, perform the following steps:

  1. Open GIT Bash and enter the following command in the terminal:

    curl -L -O https://download.elasticsearch.org/kibana/kibana/kibana-4.1.1-windows.zip
    
  2. Extract the downloaded ZIP package by either unzipping it using WinRar or 7Zip (download it if you don't have it), or using the following command in GIT Bash:

    unzip kibana-4.1.1-windows.zip
    

    This will extract the files and folder into the directory.

  3. Then click on the extracted folder and navigate through it to get to the bin folder.

  4. Click on the kibana.bat file to run Kibana.

    Note

    Make sure that Elasticsearch is running. If it is not running and you try to start Kibana, the following error will be displayed after you click on the kibana.bat file:

  5. Again, to verify the Kibana installation, open http://localhost:5601 in your browser.

Additional information

You can change the Elasticsearch configuration for your production environment, wherein you have to change parameters such as the cluster name, node name, network address, and so on. This can be done using the information mentioned in the upcoming sections.

Changing the Elasticsearch configuration

To change the Elasticsearch configuration, perform the following steps:

  1. Run the following command in the terminal to open the configuration file:

    sudo vi ~/elasticsearch-1.5.2/config/elasticsearch.yml
    

    Windows users can open the elasticsearch.yml file from the config folder. This will open the configuration file as follows:

  2. The cluster name can be changed, as follows:

    #cluster.name: elasticsearch to cluster.name: "your_cluster_name".
    

    In the preceding figure, the cluster name has been changed to test. Then, we save the file.

  3. To verify that the cluster name has been changed, run Elasticsearch as mentioned in the earlier section.

    Then open http://localhost:9200 in the browser to verify, as shown here:

In the preceding screenshot, you can notice that cluster_name has been changed to test, as specified earlier.

Changing the Kibana configuration

To change the Kibana configuration, follow these steps:

  1. Run the following command in the terminal to open the configuration file:

    sudo vi ~/kibana-4.1.1-linux-x64/config/kibana.yml
    

    Windows users can open the kibana.yml file from the config folder.

    In this file, you can change various parameters such as the port on which Kibana works, the host address on which Kibana works, the URL of Elasticsearch that you wish to connect to, and so on.

  2. For example, the port on which Kibana works can be changed by changing the port address. As shown in the following screenshot, port: 5601 can be changed to any other port, such as port: 5604. Then we save the file.

  3. To check whether Kibana is running on port 5604, run Kibana as mentioned earlier. Then open http://localhost:5604 in the browser to verify, as follows:

    In the preceding screenshot, notice that Kibana is working on port 5604, as per our change.