Knowledge Base
Tutorials
Tutorials
  • How to install Joomla 4.2.2 on Ubuntu 20.04?
  • How to set and execute environment and shell variables in Linux?
  • How to employ Docker containers?
  • How to access PostgreSQL Image?
  • How to add and delete users on Ubuntu 20.04?
  • How to add swap space on Ubuntu 20.04?
  • How to back up, restore, and migrate a MongoDB database on Ubuntu 20.04?
  • How to configure additional SSH keys to your public cloud instance?
  • How to configure static IP on Ubuntu?
  • How to create a CLI with Python Fire on Ubuntu 22.04?
  • How to create a new user and manage permissions in MySQL?
  • How to create an instance with Terraform?
  • How to import and export a MongoDB database on Ubuntu 20.04?
  • How to install 7zip on Ubuntu 20.04?
  • How to install AIDE on Ubuntu 22.04?
  • How to install Anaconda on Ubuntu 20.04?
  • How to install and use Docker on Ubuntu 20.04?
  • How to install and use Elinks on Ubuntu 20.04?
  • How to install and use PostgreSQL on Ubuntu 20.04?
  • How to install Android Studio on Ubuntu 22.04?
  • How to install Angular on Ubuntu 20.04?
  • How to install Ansible on Ubuntu 20.04?
  • How to install Apache Kafka on Ubuntu 20.04?
  • How to install Apache Maven on Ubuntu 20.04?
  • How to install Asterisk on Ubuntu 20.04?
  • How to install Atom Text Editor on Ubuntu 20.04?
  • How to install Blender on Ubuntu?
  • How to install CFEngine3 on Ubuntu 20.04?
  • How to install Code::Blocks on Ubuntu 20.04?
  • How to install Composer on Ubuntu 22.04?
  • How to install Curl on Ubuntu 20.04?
  • How to install Desktop GUI on Ubuntu 20.04?
  • How to install Discord on Ubuntu 22.04?
  • How to install Django on Ubuntu 20.04?
  • How to install Docker Compose on Ubuntu 20.04?
  • How to install ELK on Debian 10 or Debian 11?
  • How to install Fail2ban on Debian 10?
  • How to install FFmpeg on Ubuntu 20.04?
  • How to install Flask on Ubuntu 20.04?
  • How to install Fish Shell in Ubuntu 20.04?
  • How to install Gedit on Ubuntu 20.04?
  • How to install Git on Ubuntu 20.04?
  • How to install Gitea on Ubuntu 20.04?
  • How to install Gitlab on Ubuntu 20.04?
  • How to install Go on Ubuntu 20.04?
  • How to install Google Chrome on Ubuntu 20.04?
  • How to install Gradle on Debian 10?
  • How to install Gradle on Ubuntu 20.04?
  • How to install Grafana on Ubuntu 20.04?
  • How to install Hadoop on Ubuntu 20.04?
  • How to install Homebrew on Linux?
  • How to install JAVA with APT on Ubuntu 20.04?
  • How to install Julia on Ubuntu 20.04?
  • How to install Jupyter on an Ubuntu Linux VM?
  • How to install Kdenlive on Ubuntu 20.04?
  • How to install Logwatch on Ubuntu 20.04?
  • How to install MariaDB on Ubuntu 22.04?
  • How to install Memcached on Debian 10?
  • How to install Microsoft Edge Browser on Ubuntu 22.04?
  • How to install MongoDB on CentOS 7?
  • How to install MongoDB on Linux?
  • How to install Mono on Debian 10?
  • How to Install Mono on Ubuntu 20.04?
  • How to install Mozilla Firefox on Ubuntu 20.04?
  • How to install MySQL on Ubuntu 22.04?
  • How to install Nagios on Ubuntu 20.04?
  • How to install Nginx on CentOS 8?
  • How to install Nginx on Ubuntu 22.04?
  • How to install Node.js on Ubuntu 22.04?
  • How to install NVIDIA CUDA on Ubuntu 20.04?
  • How to install Nvidia Optimus Driver on Ubuntu 22.04?
  • How to install OpenCV on Ubuntu 20.04?
  • How to install Perl on Ubuntu on 22.04?
  • How to install Pacman on Ubuntu 20.04?
  • How to install phpMyAdmin on Ubuntu 20.04?
  • How to install PIP on CentOS 8?
  • How to install Plex media server on Ubuntu 20.04?
  • How to install Podman on Ubuntu 20.04?
  • How to install Poetry on Ubuntu 22.04?
  • How to install Postman on Ubuntu 20.04?
  • How to install ProcessWire on Ubuntu 20.04?
  • How to install PyQuery package on Ubuntu 20.04?
  • How to install Python 3 on Ubuntu 22.04 and set up a programming environment?
  • How to install Python on Windows 10 using UI and Windows command prompt?
  • How to install R on Ubuntu 20.04?
  • How to install Ruby on Rails on Ubuntu 20.04?
  • How to install Ruby on Ubuntu 20.04 and setup programming environment?
  • How to install Rust on Ubuntu 22.04?
  • How to install Samba on Ubuntu 20.04?
  • How to install Skype on Ubuntu 20.04?
  • How to install Rancher on Ubuntu 20.04?
  • How to install Slack on Ubuntu 20.04?
  • How to install Springboot on Ubuntu 20.04?
  • How to install Spyder IDE in Ubuntu?
  • How to install Steam on Ubuntu 20.04?
  • How to install Strapi for Production on Ubuntu 20.04?
  • How to install TeamViewer on Ubuntu 20.04?
  • How to install TensorFlow on Ubuntu 20.04?
  • How to install Apache Web Server on Ubuntu 20.04?
  • How to install the Deno JavaScript Runtime on Ubuntu 20.04?
  • How to install Open LiteSpeed Web Server on Ubuntu 22.04?
  • How to install Sublime Text Editor on Ubuntu 20.04?
  • How to install tix package on Ubuntu 20.04?
  • How to install Vagrant on Ubuntu 20.04?
  • How to install Vim on Ubuntu 20.04?
  • How to install VirtualBox on Ubuntu 20.04?
  • How to install VLC Media Player on Ubuntu 20.04?
  • How to install VMware Workstation Player on Ubuntu 20.04?
  • How to install vscode on Ubuntu 20.04?
  • How to install Webmin on Ubuntu 20.04?
  • How to install Wine on Ubuntu 20.04?
  • How to install WordPress on Ubuntu 20.04?
  • How to install Xibo on Ubuntu 20.04?
  • How to install Zoom on Ubuntu 20.04?
  • How to install Yarn on Ubuntu 20.04?
  • How to keep Ubuntu 22.04 servers updated?
  • How to monitor system authentication logs on Ubuntu 20.04?
  • How to perform basic administration tasks for Storage Devices in Linux?
  • How to set up Jenkins on Ubuntu 20.04?
  • How to setup OpenVPN on Ubuntu 20.04?
  • How to setup time synchronization on Ubuntu 20.04?
  • How to setup a UFW on an Ubuntu or Debian Cloud Server?
  • How to setup SSH keys in Ubuntu 20.04?
  • How to SSH terminal through MobaXterm and PuTTY in Windows?
  • How to Use Ansible to Install and Set Up Docker on Ubuntu 20.04?
  • How to view system users on Ubuntu 20.04?
  • How to make OpenStack accessible through CLI?
  • How to make Block Storage available for Linux?
  • Script for automated incremental backups
  • How to configure a Git repository using Linux CLI?
  • How to enable remote access on MySQL?
  • How to Mount a S3 Bucket on Linux Instance?
  • How to access MySQL database credentials?
  • How to create an incremental backup using CLI?
  • How to set up web-based SQL server on OpenStack instance using SQL image?
Powered by GitBook
On this page
  • Overview
  • Prerequisites
  • Get Started

Was this helpful?

How to install ELK on Debian 10 or Debian 11?

Overview

The Elastic Stack or ELK Stack is a collection of open-source software tools developed by Elastic that offer centralized logging, analytics, research and logs visualization gathered from any source and in any format. In order to find issues with your servers or apps, centralized logging might be helpful as it enables you to browse through all of your logs in a single location. Additionally, by comparing the logs of such servers over a predetermined period of time, you can pinpoint problems that affect multiple servers simultaneously.

In this tutorial, we'll see how to install the ELK stack, which is a is collection of three open-source tools, Elasticsearch, Kibana, and Logstash.

Prerequisites

There are certain prerequisites that need to be met before you begin.

  • Server running Debian 10 or 11

  • Access to SSH connected text editor

  • User account with root or sudo access

  • Internet connection

Get Started

Step 1: Java Installation:

Let's first update the system and install Java, which is a pre-requisite for Elasticsearch.

Oracle Java and OpenJDK are both supported by Elasticsearch, but since ELK deployment requires Java 8 or 11, we're installing OpenJDK instead.

sudo apt-get update && sudo apt-get install openjdk-8-jdk 

You may verify the installation with the following command:

 java -version 

Step 2: Public signing key:

The GPG key (GNU Privacy Guard) should be added to assure the security and legitimacy of the download source. Download the public signing key using the command below:

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

Note: You may encounter the following highlighted error while running the above command.

Run the following command to install the required packages for adding the GPG key and resolve the above said error.

apt-get update && apt-get install gnupg2 

Step 3: Transport-https package installation:

APT transport permits access of repositories via HTTP Secure protocol (HTTPS). Your Debian installation may also need to have apt-transport-https after adding the GPG key. You can obtain it by using the following command:

sudo apt-get install apt-transport-https –y 

Step 4: Saving directory definitions:

Use the following command to save the repository once apt-transport-https is available for your Debian 11 system at /etc/apt/sources.list.d/elastic-7.x.list.

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

Step 5: ELK installation:

Use the following command to collectively install Elasticsearch, Logstash and Kibana:

sudo apt-get update && sudo apt-get install Elasticsearch && sudo apt-get install Logstash && sudo apt-get install Kibana 

Step 6: Elasticsearch configuration:

Elasticsearch takes relatively minimal configuration changes, as it comes with decent default settings. Meanwhile, one needs to put the node-specific details such as node name, cluster name, network host IP and port number etc in the yaml file.

For setting up the configurations for Elasticsearch, make the following changes in the /etc/elasticsearch/elasticsearch.yml script.

  • Uncomment the highlighted code lines.

  • Give suitable name to your cluster and node.

  • Put your network host to “0.0.0.0” (this will allow traffic from each port).

  • Set your http port number to access.

  • Paste < discovery.type: single-node> at the end of the script.

Step 7: Elasticsearch service startup:

Systemctl can be used to launch the Elasticsearch service. Wait a short while for Elasticsearch to launch. Errors about being unable to connect can appear if you don't.

sudo systemctl start elasticsearch

Step 8: Services heath checkup:

By making an HTTP request, you can check if your Elasticsearch service is active:

curl -XGET http://localhost:9200/_cluster/health?pretty 

Step 9: Kibana Configuration:

We need to set the configurations for kibana, using the following commands:

nano /etc/kibana/kibana.yml 

Make the following changes in the /etc/kibana/kibana.yml script.

  • Uncomment the highlighted lines in white.

  • Set the server base URL as your localhost IP address with the input port number (here we have taken 5601).

  • Set your server's name.

  • Set the address for Elasticsearch host.

Step 10: Kibana Startup:

systemctl start kibana 

Step 11: Logstash configuration:

We need to create a configuration file for logstash, using the command below:

sudo nano /etc/logstash/conf.d/30-elasticsearch-output.conf

Paste the following lines of code into the file, and make sure to put your localhost IP address, as shown in the image below.

Step 12: Logstash Startup:

Start Logstash and enable it if your configuration test is successful to apply the configuration changes:

systemctl start logstash 

Step 13: Services Startup:

If all your configuration tests are successful, enable all the three installed services to start and put the configuration changes into effect:

  1. systemctl enable elasticsearch

  2. systemctl enable kibana

  3. systemctl enable logstash

As a next step, visit http:localhost/5601 in your browser and you’ll be prompted to the Elasticsearch home page, from where you can navigate and explore different windows including kibana, logstash and other integrations.

PreviousHow to install Docker Compose on Ubuntu 20.04?NextHow to install Fail2ban on Debian 10?

Last updated 1 year ago

Was this helpful?