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:

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:

  1. Open the Terminal by pressing CTRL + ALT + T key combination.

  2. Run the following command to update your system’s package index:

sudo apt update
  1. Install the docker.io package using the following command:
sudo apt install docker.io
  1. 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.

  1. Open the Terminal by pressing CTRL + ALT + T key combination.

  2. 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
  1. Create a new file named loki-config.yaml using the following command:
nano loki-config.yaml
  1. 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
  1. 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:

  1. 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.

  1. Open a web browser.

  2. Visit http://localhost:3100/ and you should see the Loki user interface.

  3. Click on the "Explore" button in the top-left corner of the screen.

  4. You can now query logs from any of the available targets.

Congratulations! You have successfully installed Loki on your Linux Mint system.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!