How To Install InfluxDB on Debian 11 / Debian 10

Posted on 66 views

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.

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

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

sudo apt update
sudo 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.

sudo 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

Apr 20 10:11:03 centos.example.com influxd-systemd-start.sh[8274]: ts=2022-04-20T10:11:03.766647Z lvl=info msg="Starting HTTP service" log_id=0_yc6TNl000 service=httpd authentication=true
Apr 20 10:11:03 centos.example.com influxd-systemd-start.sh[8274]: ts=2022-04-20T10:11:03.766652Z lvl=info msg="opened HTTP access log" log_id=0_yc6TNl000 service=httpd path=stderr
Apr 20 10:11:03 centos.example.com influxd-systemd-start.sh[8274]: ts=2022-04-20T10:11:03.766655Z lvl=info msg="Auth is enabled but shared-secret is blank. BearerAuthenticatio...vice=httpd
Apr 20 10:11:03 centos.example.com influxd-systemd-start.sh[8274]: ts=2022-04-20T10:11:03.766820Z lvl=info msg="Listening on HTTP" log_id=0_yc6TNl000 service=httpd addr=[::]:8...ttps=false
Apr 20 10:11:03 centos.example.com influxd-systemd-start.sh[8274]: ts=2022-04-20T10:11:03.766835Z lvl=info msg="Starting retention policy enforcement service" log_id=0_yc6TNl0...terval=30m
Apr 20 10:11:03 centos.example.com influxd-systemd-start.sh[8274]: ts=2022-04-20T10:11:03.767095Z lvl=info msg="Storing statistics" log_id=0_yc6TNl000 service=monitor db_insta...terval=10s
Apr 20 10:11:03 centos.example.com influxd-systemd-start.sh[8274]: ts=2022-04-20T10:11:03.767304Z lvl=info msg="Sending usage statistics to usage.influxdata.com" log_id=0_yc6TNl000
Apr 20 10:11:03 centos.example.com influxd-systemd-start.sh[8274]: ts=2022-04-20T10:11:03.768036Z lvl=info msg="Listening for signals" log_id=0_yc6TNl000
Apr 20 10:11:04 centos.example.com influxd-systemd-start.sh[8274]: [httpd] ::1 - - [20/Apr/2022:10:11:04 +0000] "GET /health HTTP/1.1" 200 107 "-" "curl/7.29.0" 3022e0fe-c092-...669bb5 387
Apr 20 10:11:04 centos.example.com systemd[1]: Started InfluxDB is an open-source, distributed, time series database.

Open influxdb service ports on the firewall

For users using ufw firewall, allow service port.

sudo apt -y install ufw
sudo ufw enable
sudo ufw allow 22/tcp
sudo 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.

$ sudo vim /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.

Related guides:

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.