Tecnologias da Informação
How To Install InfluxDB on Debian 10/11

How To Install InfluxDB on Debian 10/11

InfluxDB is an Open Source time series database designed for monitoring metrics and events while providing a real-time visibility into stacks. InfluxDB is a product developed by InfluxData as part of TICK Stack – which comprises of Telegraf, InfluxDB, Chronograf and Kapacitor. It is a fast Go time series database designed for high availability.

InfluxDB can be easily configured using the configuration file (influxdb.conf) and environment variables. Without much theory, let’s dive into the installation of InfluxDB on Debian 11 / Debian 10 Linux distribution.

Install InfluxDB on Debian 11 / Debian 10 Linux

Add InfluxDB APT repository.

apt update
apt install -y gnupg2 curl wget
wget -qO- https://repos.influxdata.com/influxdb.key | apt-key add -
echo "deb https://repos.influxdata.com/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/influxdb.list

Once the repository is added, install InfluxDB onDebian 11 / Debian 10 Linux:

apt update
apt install -y influxdb

InfluxDB default configuration file is located under /etc/influxdb/influxdb.conf. Most sections are commented out, you can modify it to your liking and restart influxdb service after.

Start and enable the service to start on boot up.

systemctl enable --now influxdb

Check service status:

$ systemctl status influxdb
● influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/usr/lib/systemd/system/influxdb.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2022-04-20 10:11:04 UTC; 47min ago
     Docs: https://docs.influxdata.com/influxdb/
 Main PID: 8275 (influxd)
   CGroup: /system.slice/influxdb.service
           └─8275 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

Open influxdb service ports on the firewall

For users using ufw firewall, allow service port.

apt -y install ufw
ufw enable
ufw allow 22/tcp
ufw allow 8086/tcp

By default, InfluxDB uses the following network ports:

  • TCP port 8086 is used for client-server communication over InfluxDB’s HTTP API
  • TCP port 8088 is used for the RPC service for backup and restore

Configure InfluxDB http Authentication (Optional)

If you need http authentication, modify influxdb http section to contain the following.

$ nano /etc/influxdb/influxdb.conf 
[http]
 auth-enabled = true

Then create a user with an authentication password:

curl -XPOST "http://localhost:8086/query" --data-urlencode "q=CREATE USER username WITH PASSWORD 'strongpassword' WITH ALL PRIVILEGES"

Replace:

  • username with your own username
  • strongpassword with your own password (note that the password requires single quotes)

Now whenever you need to run any influxdb commands on the terminal, you need to specify username using -username and password using -password options.

$ influx -username 'username' -password 'password'

For curl, use -u to specify username and password separated by a colon.

curl -G http://localhost:8086/query -u username:password --data-urlencode "q=SHOW DATABASES"

Enjoy using InfluxDB onDebian 11 / Debian 10 Linux distribution.