Deploying the Elastic Stack on Ubuntu 24.04: Architecture, Installation, and Configuration

The Elastic Stack, historically known as the ELK Stack, represents the industry standard for centralized log management, security information and event management (SIEM), and observability. Comprising Elasticsearch, Logstash, and Kibana, this suite of open-source tools provides a robust framework for retrieving, analyzing, and visualizing data from diverse sources. While the core triad handles search, processing, and visualization, the ecosystem is often extended with Beats, lightweight data shippers that aggregate information from various streams, and additional tools like Zeek for network monitoring. For administrators and developers seeking to establish a resilient monitoring infrastructure on Ubuntu 24.04 (Noble Numbat), understanding the architectural prerequisites, repository configurations, and service management is critical. This guide details the technical procedures for installing and configuring these components, addressing both legacy methodologies and the latest Elastic Stack 9.x deployments.

Architectural Components and System Prerequisites

Before initiating the installation process, it is essential to understand the distinct roles of the stack’s components and the hardware resources required to support them. Elasticsearch serves as the foundational search and analytics engine. Built on Apache Lucene, it is a distributed, RESTful system designed for high performance. Its schema-free nature, supporting JSON documents and myriad programming languages, makes it ideal for log analytics. Logstash functions as the server-side data processing pipeline. It collects data from multiple heterogeneous sources, transforms it through filters and codecs, and ships the processed data to destinations such as Elasticsearch. Kibana provides the web-based user interface and data visualization layer. It transforms the raw data stored in Elasticsearch into actionable insights through histograms, line graphs, pie charts, heat maps, and geospatial visualizations.

The hardware requirements for the Elastic Stack vary significantly based on the intended use case. Small-scale testing or development environments have lower resource demands, whereas production environments handling large datasets require robust infrastructure. For Elastic Stack 9.x, the minimum hardware specifications are stringent. Development or test environments require a minimum of 8 GB of RAM, while production deployments handling substantial data volumes should be provisioned with 64 GB or more. CPU requirements specify a minimum of 4 cores, though additional cores improve performance during indexing and search operations. Storage capacity is not fixed; it depends entirely on the projected data volume and the retention policies defined by the organization.

To begin the setup on Ubuntu 24.04, the system must meet specific software prerequisites. A stable internet connection is required to download packages and repository keys. The administrator must have a user account with sudo privileges to execute system-level configuration commands. Basic familiarity with the Linux command line is assumed, as the installation involves editing configuration files, managing system services, and handling GPG keys. For Ubuntu 24.04 specifically, a minimum of 4 GB of RAM is often cited as a baseline for functional operation, though the higher recommendations for version 9.x should be prioritized for stability.

Configuring System Identity and Java Environment

The installation process begins with configuring the system identity and ensuring the necessary runtime environments are present. Setting a proper hostname is a best practice for cluster identification and DNS resolution. In a production or test environment, the hostname can be set using the hostnamectl command. For example, setting the hostname to a descriptive identifier like elk-node-01.kifarunix-demo.com aids in network management. If a DNS server is not available, the local hosts file must be updated to map the IP address to the hostname. This is achieved by appending the IP address and hostname to the /etc/hosts file, ensuring that the system can resolve its own identity during inter-service communication.

Java is a critical dependency for the Elastic Stack, particularly for Elasticsearch, which is developed in Java. The components require a Java Runtime Environment (JRE) or Java Development Kit (JDK) to operate. While some Elastic packages include their own bundled JVM, installing a system-level JDK is a common prerequisite step in many installation guides. Administrators must ensure that a compatible version of Java is installed before proceeding with the Elastic components. The specific version of Java required may vary depending on the version of the Elastic Stack being deployed, so verifying compatibility between the JDK and the target Elastic version is a necessary due diligence step.

Adding the Elastic Repository and GPG Keys

To access the official packages for the Elastic Stack, the Ubuntu system must be configured to trust and pull from the Elastic repositories. This process involves importing a GPG key to verify the authenticity of the software and adding the repository to the system’s apt sources list. The method for adding the repository depends on the desired version of the stack, with distinct paths for older versions (such as 7.x) and the newer 9.x release.

For Elastic Stack 9.x, the process begins with updating the system and installing necessary utilities like gnupg2. The GPG key is retrieved using wget and processed with gpg to create a keyring file. This key is then placed in the /etc/apt/trusted.gpg.d/ directory to ensure that the package manager trusts the signatures from Elastic. Following the key import, the repository line is added to the sources list. This involves echoing the specific deb entry for the 9.x stable channel into a new file in /etc/apt/sources.list.d/. Once the repository is defined, the package list must be updated to reflect the new source.

For older versions, such as 7.x, a slightly different approach is often documented. This involves using apt-transport-https and curl to fetch the GPG key and adding it directly via apt-key. The repository line for 7.x is then written to /etc/apt/sources.list.d/elastic-7.x.list. While this method is functional for legacy deployments, modern Ubuntu versions have deprecated apt-key in favor of the keyring method used in the 9.x installation. Therefore, the GPG dearmoring method is the recommended approach for Ubuntu 24.04.

```bash

Install required utilities

sudo apt update
sudo apt install gnupg2 -y

Download and dearmor the GPG key for Elastic Stack 9.x

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | \
gpg --dearmor -o /etc/apt/trusted.gpg.d/elastic.gpg

Add the Elastic Stack 9.x repository

echo "deb https://artifacts.elastic.co/packages/9.x/apt stable main" > /etc/apt/sources.list.d/elastic-9.x.list

Update the package index

sudo apt update
```

Installing and Managing Core Components

With the repository configured, the individual components of the stack can be installed using the apt package manager. The core installation command typically includes elasticsearch, logstash, and kibana. Depending on the specific use case, administrators might install all three or focus on specific subsets. For instance, a minimal setup for testing might only install Elasticsearch and Kibana. The Beats tools, if required for data aggregation, can be installed separately or as part of the broader package selection.

Once installed, the components must be enabled and started as system services. Systemd is the standard service manager on Ubuntu, providing tools to control the lifecycle of these applications. Enabling the services ensures that they start automatically upon system boot, which is critical for maintaining continuous log collection and availability. Starting the services brings the applications online for immediate use.

```bash

Install Elasticsearch, Logstash, and Kibana

sudo apt install elasticsearch logstash kibana

Enable and start Elasticsearch

sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch

Enable and start Logstash

sudo systemctl enable logstash
sudo systemctl start logstash

Enable and start Kibana

sudo systemctl enable kibana
sudo systemctl start kibana
```

Configuring Security and Network Access

Modern versions of the Elastic Stack, particularly version 9.x, enforce security features by default. This includes enabling authentication and encryption for data in transit. Administrators must configure these security settings to ensure that access to Elasticsearch and Kibana is restricted to authorized users only. This involves generating or setting passwords for the built-in users and configuring the elasticsearch.yml and kibana.yml files to specify network hosts and port bindings. By default, Kibana listens on port 5601, and Elasticsearch on port 9200, but these defaults can be modified to fit security policies.

For environments requiring network monitoring beyond standard logs, tools like Zeek can be integrated. Zeek is a powerful network analysis tool that complements the ELK stack by providing deep visibility into network traffic. Installing Zeek involves adding its specific repository and installing the package. Once installed, Zeek generates log files that Logstash can ingest, process, and send to Elasticsearch for visualization in Kibana. This creates a comprehensive observability platform that covers both application logs and network behavior.

The integration of Zeek with the ELK stack typically involves configuring Logstash to read Zeek’s log files and forward them to the Elasticsearch index. This requires defining input and output filters in the Logstash configuration files. Additionally, setting up the Elastic Agent with Fleet can provide a centralized way to manage data collection across multiple nodes, although this is a more advanced configuration suitable for larger deployments.

Verifying Installation and Accessing Kibana

After the services are started, the final step is to verify that the stack is operational. The primary method for verification is accessing the Kibana web interface. Since Kibana typically binds to localhost by default, the user must open a web browser and navigate to http://localhost:5601. If the installation and configuration are correct, the Kibana login page or dashboard will appear. For remote access, the Kibana configuration must be updated to bind to a specific IP address or 0.0.0.0, and firewall rules must be adjusted to allow traffic on port 5601.

Troubleshooting common issues involves checking the status of the systemd services. If a service fails to start, the logs can be inspected using journalctl or by examining the specific log files for each component in the /var/log/ directory. Common errors include Java version mismatches, port conflicts, or insufficient permissions. Ensuring that the GPG keys are correctly installed and that the repository URLs are accessible can resolve many package installation failures. For high-availability clusters, additional configuration is required to enable node discovery and shard replication, but the single-node setup described here provides a solid foundation for development and small-scale production use.

Conclusion

Deploying the Elastic Stack on Ubuntu 24.04 involves a methodical approach to repository management, service configuration, and security enforcement. The transition to Elastic Stack 9.x introduces stricter security defaults and higher resource requirements, particularly in memory, compared to earlier versions. By following the established procedures for importing GPG keys, adding repositories, and managing systemd services, administrators can establish a reliable foundation for log analytics and observability. The integration of additional tools like Zeek expands the scope of monitoring to include network traffic, providing a holistic view of system health. As organizations continue to rely on data-driven insights, the Elastic Stack remains a critical component of modern infrastructure, offering the scalability and flexibility needed to handle growing data volumes.

Sources

  1. How to Install ELK Stack on Ubuntu

  2. How to Install Elastic ELK Stack on Ubuntu 24.04

  3. How to install ELK on Ubuntu 24.04.1

  4. How to Install ELK Stack on Ubuntu

  5. ELK Stack: A Comprehensive Guide to Installing and Configuring

  6. Install ELK Stack 9.x on Ubuntu 24.04

Related Posts