How to Install Cortex Observable Analysis Tool on Ubuntu 22.04
How to Install Cortex Observable Analysis Tool on Ubuntu 22.04
Author: Łukasz Bodziony
Email: lukasz@bodziony.net.pl
DevOps Services: bodziony.net.pl
Published: June 2025
Introduction
Cortex is a horizontally scalable, multi-tenant, long-term Prometheus-compatible monitoring and analysis tool. In this tutorial, Łukasz Bodziony will show you how to install and configure Cortex on Ubuntu 22.04, so you can aggregate, store, and query metrics at scale.
Prerequisites
- Ubuntu 22.04 LTS server with sudo/root access
- At least 4 GB RAM (8 GB+ recommended for production)
- Static IP or DNS name pointing to your server
- Object storage (e.g., Amazon S3) or local filesystem for chunk storage
Step 1: Update System & Install Dependencies
sudo apt update && sudo apt upgrade -y
sudo apt install -y wget unzip
Step 2: Create Directories
sudo mkdir -p /etc/cortex /var/lib/cortex/chunks /var/lib/cortex/rules
Step 3: Download & Extract Cortex
CORTEX_VERSION="1.13.1"
cd /tmp
wget https://github.com/grafana/cortex/releases/download/v${CORTEX_VERSION}/cortex-${CORTEX_VERSION}.linux-amd64.zip
unzip cortex-${CORTEX_VERSION}.linux-amd64.zip
sudo mv cortex-${CORTEX_VERSION}.linux-amd64/cortex /usr/local/bin/
Step 4: Configure Cortex
Create a minimal config file at /etc/cortex/config.yaml
:
storage:
backend: filesystem
filesystem:
dir: /var/lib/cortex/chunks
server:
http_listen_port: 9009
grpc_listen_port: 9095
distributor:
ring:
kvstore:
store: in-memory
ingester:
lifecycler:
ring:
kvstore:
store: in-memory
querier:
engine:
timeout: 2m
lookback_delta: 5m
max_samples: 500000
Step 5: Create a systemd Service
Create /etc/systemd/system/cortex.service
:
[Unit]
Description=Cortex Observability Service
After=network.target
[Service]
User=root
ExecStart=/usr/local/bin/cortex \
-config.file=/etc/cortex/config.yaml
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
Reload systemd and start Cortex:
sudo systemctl daemon-reload
sudo systemctl enable --now cortex
sudo systemctl status cortex
Step 6: Verify Installation
Open your browser and visit the Cortex HTTP API:
http://Your-Server-IP:9009/metrics
You should see Prometheus-compatible metrics exposed by Cortex.
Conclusion
You now have Cortex up and running on Ubuntu 22.04, ready to collect and query metrics at scale. For production, consider integrating object storage (S3, GCS) and a proper KV store (Consul, DynamoDB).
🚀 Host your observability stack on a high-performance Linux VPS: netcloud24.com/servers/vps-linux/
Comments
Post a Comment