Open In App

How to Install Grafana Loki on Ubuntu?

Last Updated : 30 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Loki is a Prometheus-inspired multi-tenant, highly available, and possibly, horizontally scalable log aggregation system solution. A robust logging system called Grafana Loki is made to effectively gather, store, and query logs from several sources through the system. It is made by the software engineers to be incredibly simple to use and economical. It offers a complete observability internal stack and is designed to integrate with the Grafana system with ease.

In this article, we'll explore the initial steps to install and configure Grafana Loki on an Ubuntu system.

How to Install and Configure Grafana Loki on Ubuntu?

Grafana can be installed in different ways or techniques. Users need to follow the below-mentioned easy steps or techniques to install and configure Grafana Loki on Ubuntu OS.

Step 1: Install and Configure Grafana from the APT repository

  • Download the prerequisite packages by following the below-mentioned command
sudo apt-get install -y apt-transport-https software-properties-common wget
Download_Grafana-(2)
  • Import the internal GPG Key > Run the Command to add the repository for beta releases
sudo mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null

echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
  • Update the list of available packages
# Updates the list of available packages
sudo apt-get update
  • Run the Command to install Grafana OSS
# Installs the latest OSS release:
sudo apt-get install grafana
  • Run the Command to install Grafana Enterprise
# Installs the latest Enterprise release:
sudo apt-get install grafana-enterprise

Step 2: Install Loki

  • Download Loki according to the system configuration and CPU architecture as shown below -
https://github.com/grafana/loki/releases/
  • Unzip the pre-downloaded file
sudo apt install unzip -y
unzip loki-linux-amd64.zip
  • Move the configured Loki binary to a directory in the system PATH
sudo mv loki-linux-amd64 /usr/local/bin/loki
sudo chmod a+x /usr/local/bin/loki
  • Create a new Loki configuration file > Add new configuration > Save it and close
auth_enabled: false

server:
http_listen_port: 3100

ingester:
lifecycler:
address: 127.0.10.1
ring:
kvstore:
store: inmemory
replication_factor: 10
final_sleep: 1s
chunk_idle_period: 6m
chunk_retain_period: 45s
max_transfer_retries: 10

schema_config:
configs:
- from: 2024-10-22
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 22h

storage_config:
boltdb_shipper:
active_index_directory: /tmp/loki/index
cache_location: /tmp/loki/index_cache
shared_store: filesystems
filesystems:
directory: /tmp/loki/chunks

limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 154h

chunk_store_config:
max_look_back_period: 1s

table_manager:
retention_deletes_enabled: false
retention_period: 1s

Step 3: Download and Install Grafana using a .deb package

  • Go to the Official Grafana Download Page > Select Version and Edition
Download_Grafana-(2)
  • Click on the Linux or ARM64 tab as per requirement > Copy and Paste the given code in the command line.
Commands_Grafana-(1)

Conclusion

Users can now get greater insights into the system infrastructure and applications with Grafana Loki, which simplifies internal troubleshooting and boosts the system's performance. All the users have to install Grafana Loki on their Ubuntu server and enable a reliable and effective logging system by following the mentioned steps or techniques. With this configuration, users can easily gather, store, and examine all the internal logs in conjunction with Grafana Loki on Ubuntu, offering a complete observability solution or process.

Also Read


Next Article
Article Tags :

Similar Reads