Monitoring

How to Install and Configure Kibana on Ubuntu 20.04

Pinterest LinkedIn Tumblr

In this guide, we will learn how to install and configure Kibana on Ubuntu 20.04.

Kibana is a proprietary data visualization dashboard software for Elasticsearch, whose open source successor in OpenSearch is OpenSearch Dashboards. It is a data visualization and exploration tool used for log and time-series analytics, application monitoring, and operational intelligence use cases. It offers powerful and easy-to-use features such as histograms, line graphs, pie charts, heat maps, and built-in geospatial support. Kibana also acts as the user interface for monitoring, managing, and securing an Elastic Stack cluster — as well as the centralized hub for built-in solutions developed on the Elastic Stack. 

Related Content:

Table of Content

  1. Ensure the server is up to date
  2. Import the Elastic gpg key
  3. Install Kibana from the RPM Repo
  4. Starting and enabling Kibana service
  5. Enable the service in firewall
  6. Configuring Kibana
  7. Accessing Kibana

1. Ensuring that the server is up to date

Before proceeding, let us ensure that our server is up to date and all the packages are the latest version. Use these commands to achieve this:

sudo apt update
sudo apt upgrade -y

If there are packages to upgrade, the above command may take a couple of minutes.

Let us also install some common packages that we will need later:

sudo apt install -y vim wget

2. Import the Elasticsearch PGP Key

Elasticsearch signs all of our packages with the Elasticsearch Signing Key (PGP key D88E42B4, available from https://pgp.mit.edu) with fingerprint:

4609 5ACC 8548 582C 1A26 99A9 D27D 666C D88E 42B4

Download and install the public signing key:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

3. Install Elasticsearch from the APT repository

Save the repository definition to /etc/apt/sources.list.d/elastic-7.x.list:

echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list

You can then install the Elasticsearch package with:

sudo apt-get update && sudo apt-get install kibana

Confirm the installation

kibana:
  Installed: 7.16.3
  Candidate: 7.16.3
  Version table:
 *** 7.16.3 500
        500 https://artifacts.elastic.co/packages/7.x/apt stable/main amd64 Packages
        100 /var/lib/dpkg/status

4. Start and enable Kibana service

The Kibana service won’t be started by default. Use this command to start:

sudo systemctl start kibana

Confirm the service status using this command:

$ sudo systemctl status kibana
● kibana.service - Kibana
     Loaded: loaded (/etc/systemd/system/kibana.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-01-18 21:22:30 UTC; 13s ago
       Docs: https://www.elastic.co
   Main PID: 44218 (node)
      Tasks: 11 (limit: 4624)
     Memory: 435.3M
     CGroup: /system.slice/kibana.service
             └─44218 /usr/share/kibana/bin/../node/bin/node /usr/share/kibana/bin/../src/cli/dist --logging.dest=/var/log/kibana/kibana.log --pid.file=/run/kibana/kibana.pid

Jan 18 21:22:30 dev-ubuntusrv.inv.re systemd[1]: Started Kibana.

The above output shows that the service is up and running. Enable the service using this command:

sudo systemctl enable kibana

5. Enable the service in firewall

If you have firewall installed and enabled, you need to allow the service. Use these commands to achieve that:

sudo ufw allow 5601/tcp

6. Configuring Kibana

Kibana configuration file can be found in this path /etc/kibana/kibana.yml. Kibana will run as a http service exposing port 5601. It is bound to localhost by default. Confirm this using this command:

ss -tulpn | grep 5601

This is my output:

$ ss -tulpn | grep 5601
tcp   LISTEN 0      511             127.0.0.1:5601         0.0.0.0:*

To bind the service to all ports so the service can be accessed remotely, addd this line to the file:

server.host: "0.0.0.0"

To connect to an Elasticsearch instance, use this:

elasticsearch.hosts: ["http://localhost:9200"]

If you have configured a password for your elasticsearch, configure with this:

elasticsearch.username: "kibana_system"
elasticsearch.password: "pass"

If you do not have Elasticsearch installed, please check out this guide How to Install and Configure Elasticsearch on Ubuntu 20.04.

To apply the changes, you need to restart the kibana service:

sudo systemctl restart kibana

7. Accessing Kibana dashboard

Access the Kibana dashboard on your web browser at http://server-IP:5601. You can now configure your graphs and metrics.

I am a Devops Engineer, but I would describe myself as a Tech Enthusiast who is a fan of Open Source, Linux, Automations, Cloud and Virtualization. I love learning and exploring new things so I blog in my free time about Devops related stuff, Linux, Automations and Open Source software. I can also code in Python and Golang.

Write A Comment