How To Install InfluxDB on Ubuntu 22.04|20.04|18.04

Posted on 247 views

Welcome to our guide on how to install InfluxDB on Ubuntu 22.04|20.04|18.04 Linux system. InfluxDB is an Open Source Time Series Database Platform for storing  Time Series Data, these are metrics & Events collected from different devices. It is a product of InfluxData and part of TICK Stack – which comprises:

T – Telegraf; This is an agent written in Go for collecting performance metrics from the system it’s running on and the services running on that system. The collected metrics are output to InfluxDB or other supported data stores.
I – InfluxDB
C – Chronograf; A web application written in Go and React.js that provides the tools to visualize your monitoring data and easily create alerting and automation rules.
K – Kapacitor A data processing engine.  It can process both stream and batch data from InfluxDB

In my monitoring series guides, I concentrated on the use of:

  • Telegraf for collecting metrics from systems
  • InfluxDB as Datastore
  • Grafana for metrics visualization

InfluxDB installation for CentOS is available –> Install Grafana and InfluxDB on CentOS 7

Install InfluxDB on Ubuntu 22.04|20.04|18.04

Installation of InfluxDB on Ubuntu22.04|20.04|18.04 is done from Influxdata repository. Once the repo is added, the package can then be installed using an apt package manager. Add the InfluxData repository to the file  /etc/apt/sources.list.d/influxdb.list :

Add repo to Ubuntu 22.04/20.04:

echo "deb focal stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

Add repo to Ubuntu 18.04:

echo "deb bionic stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

Import GPG key:

sudo curl -sL | sudo apt-key add -

Update apt index and install InfluxDB on Ubuntu 22.04|20.04|18.04:

sudo apt-get update
sudo apt-get install influxdb

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 (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-05-05 21:50:57 CEST; 23s ago
       Docs: man:influxd(1)
   Main PID: 1752 (influxd)
      Tasks: 9 (limit: 2286)
     Memory: 3.5M
     CGroup: /system.slice/influxdb.service
             └─1752 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

May 05 21:50:57 ubuntu-2gb-hel1-1 influxd[1752]: ts=2020-05-05T19:50:57.152991Z lvl=info msg="Registered diagnostics client" log_id=0Mab6H60000 service>
May 05 21:50:57 ubuntu-2gb-hel1-1 influxd[1752]: ts=2020-05-05T19:50:57.153051Z lvl=info msg="Starting precreation service" log_id=0Mab6H60000 service=>
May 05 21:50:57 ubuntu-2gb-hel1-1 influxd[1752]: ts=2020-05-05T19:50:57.153066Z lvl=info msg="Starting snapshot service" log_id=0Mab6H60000 service=sna>
May 05 21:50:57 ubuntu-2gb-hel1-1 influxd[1752]: ts=2020-05-05T19:50:57.153078Z lvl=info msg="Starting continuous query service" log_id=0Mab6H60000 ser>
May 05 21:50:57 ubuntu-2gb-hel1-1 influxd[1752]: ts=2020-05-05T19:50:57.153110Z lvl=info msg="Starting HTTP service" log_id=0Mab6H60000 service=httpd a>
May 05 21:50:57 ubuntu-2gb-hel1-1 influxd[1752]: ts=2020-05-05T19:50:57.153118Z lvl=info msg="opened HTTP access log" log_id=0Mab6H60000 service=httpd >
May 05 21:50:57 ubuntu-2gb-hel1-1 influxd[1752]: ts=2020-05-05T19:50:57.153190Z lvl=info msg="Listening on HTTP" log_id=0Mab6H60000 service=httpd addr=>
May 05 21:50:57 ubuntu-2gb-hel1-1 influxd[1752]: ts=2020-05-05T19:50:57.153171Z lvl=info msg="Storing statistics" log_id=0Mab6H60000 service=monitor db>
May 05 21:50:57 ubuntu-2gb-hel1-1 influxd[1752]: ts=2020-05-05T19:50:57.153212Z lvl=info msg="Starting retention policy enforcement service" log_id=0Ma>
May 05 21:50:57 ubuntu-2gb-hel1-1 influxd[1752]: ts=2020-05-05T19:50:57.153297Z lvl=info msg="Listening for signals" log_id=0Mab6H60000

Install InfluxDB on Debian 9

Add InfluxDB repository using the following command:

echo "deb stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

Import repo gpg key for installing signed packages:

sudo curl -sL | sudo apt-key add -

Update apt index and install InfluxDB on Debian 9:

sudo apt-get update
sudo apt-get install -y influxdb

Start influxdb service:

sudo systemctl start influxdb
sudo systemctl enable influxdb

You can check the status to confirm if running using:

systemctl status influxdb

Open influxdb service ports on the firewall

I use ufw firewall on all my Ubuntu 22.04|20.04|18.04 servers. If ufw is not installed, install it using the command:

sudo apt-get install ufw

Then activate firewall service:

sudo ufw enable

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

We will open port 8086 since telegraf will push metrics using this port.

sudo ufw allow 8086/tcp

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.

InfluxDB http Authentication (optional)

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

$ sudo vim /etc/influxdb/influxdb.conf 
 auth-enabled = true

Restart influxdb service:

sudo systemctl restart influxdb

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"


– 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'
Connected to http://localhost:8086 version 1.6.4
InfluxDB shell version: 1.6.4

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"

By default, influxdb service is listening on all interfaces on port 8086.

Similar guides:

Install InfluxDB CentOS 7 / CentOS 8


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