How to Install Loki on Linux Mint
Loki is a log aggregation system inspired by Prometheus. It can be used to collect, store and query logs from various sources in a distributed environment. In this tutorial, we will guide you through the installation process of Loki on Linux Mint.
Pre-requisites
Before we begin, please make sure that your system has the following requirements:
- Linux Mint latest version.
- Sudo privileges.
Step 1: Install Docker
Docker is a containerization platform that allows you to run applications in isolated and portable environments. To install Docker on Linux Mint, follow these steps:
Open the Terminal by pressing
CTRL + ALT + Tkey combination.Run the following command to update your system’s package index:
sudo apt update
- Install the
docker.iopackage using the following command:
sudo apt install docker.io
- Check the Docker version using the following command:
docker --version
You should now see the Docker version installed on your system.
Step 2: Install Loki
Now that we have Docker installed on our system, we can proceed to install Loki.
Open the Terminal by pressing
CTRL + ALT + Tkey combination.Create a new directory for the Loki configuration file and change the directory to the newly created directory:
mkdir -p ~/loki/config && cd ~/loki/config
- Create a new file named
loki-config.yamlusing the following command:
nano loki-config.yaml
- Paste the following content into the configuration file and save it:
auth_enabled: false
server:
http_listen_port: 3100
ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s
schema_config:
configs:
- from: 2021-06-01
store: boltdb
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
boltdb:
directory: /tmp/loki/index
filesystem:
directory: /tmp/loki/chunks
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
chunk_store_config:
max_look_back_period: 0s
table_manager:
chunk_tables_provisioning:
inactive_read_throughput: 0
inactive_write_throughput: 0
provisioned_read_throughput: 0
provisioned_write_throughput: 0
provisioned_write_capacity_auto_scaling: true
retention_deletes_enabled: false
retention_period: 0s
- Create the Loki Docker container using the following command:
sudo docker run -d --name loki -p 3100:3100 -v ~/loki/config:/etc/loki --restart always grafana/loki:latest -config.file=/etc/loki/loki-config.yaml
In the above command:
-dflag runs the container in the background (detached mode).--nameoption sets the name of the container.-poption maps the container port to the host port.-voption mounts the host directory to the container's directory.--restartoption restarts the container automatically.grafana/loki:latestis the name of the Docker image.-config.fileoption points to the location of the configuration file.
- To check the status of the Loki container, run the following command:
sudo docker ps
You should now see the Loki container running in the list of active containers.
Step 3: Verify the installation
Now that we have installed Loki, we can verify that it is working by accessing the Loki Web UI.
Open a web browser.
Visit http://localhost:3100/ and you should see the Loki user interface.
Click on the "Explore" button in the top-left corner of the screen.
You can now query logs from any of the available targets.
Congratulations! You have successfully installed Loki on your Linux Mint system.