How to Install Loki on POP! OS Latest

Loki is an open-source log aggregation system designed to process and store massive amounts of logs efficiently. In this tutorial, we will walk you through the steps to install Loki on POP! OS Latest.

Prerequisites

Step 1: Add Loki Repository to POP! OS

The first step is to add the Loki repository to your POP! OS system. To do that, you need to create a new file as loki.list in the sources.list.d directory.

Open the terminal by pressing Ctrl+Alt+T and run the following command:

sudo nano /etc/apt/sources.list.d/loki.list

Add the following content into the file:

deb https://packagecloud.io/grafana/loki/ubuntu/ bionic main

Now save the file by pressing Ctrl+O and exit Nano editor by pressing Ctrl+X.

Next, import the GPG key and update the repository cache by running the commands below:

curl https://packagecloud.io/gpg.key | sudo apt-key add -
sudo apt update

Step 2: Install Loki

At this point, you can easily install Loki using apt-get. Run the following command to install Loki:

sudo apt-get install loki

Hit y and enter when prompted to confirm your installation. It will take a moment to complete the process.

Step 3: Configure Loki

After Loki installation, you need to configure it to collect and process logs. Open the configuration file by running the command:

sudo nano /etc/loki/local-config.yaml

Add the following configuration into the file:

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
  max_transfer_retries: 0

schema_config:
  configs:
    - from: 2022-01-01
      store: boltdb-shipper
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 168h

storage_config:
  boltdb_shipper:
    active_index_directory: /data/loki/boltdb-shipper-active
    cache_location: /data/loki/boltdb-cache
    cache_ttl: 24h
    shared_store: filesystem

  filesystem:
    directory: /data/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:
  retention_deletes_enabled: false
  retention_period: 0

Save and exit the editor.

Step 4: Start Loki Service

Now you can start the Loki service by running the following command:

sudo systemctl start loki
sudo systemctl enable loki

You can also check the status of the service by running:

sudo systemctl status loki

Conclusion

Congratulations, you have successfully installed and configured Loki on your POP! OS system. You can now start sending logs to Loki for processing and storing.

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!