Skip to content

 Threejs and TypeScript
 SocketIO and TypeScript
 Blender Topological Earth
 Sweet Home 3D
 Design Patterns Python
 Design Patterns TypeScript
 Course Coupon Codes
Three.js and TypeScript
Kindle Edition
$9.99 $14.99 Paperback 
$29.99 $34.99

Design Patterns in TypeScript
Kindle Edition
$9.99 $14.99 Paperback
$19.99 $24.99

Design Patterns in Python
Kindle Edition
$9.99 $14.99 Paperback
$19.99 $24.99

Install InfluxDB2 Server and Data Source

Video Lecture

Install InfluxDB Server and Data Source Install InfluxDB Server and Data Source Install InfluxDB Server and Data Source


We are going to install InfluxDB v2, the InfluxDB data source, a Telegraf agent and then collect some data.

InfluxDB is a database useful for storing large amounts of time stamped data.

Telegraf is an agent that supports plugins and it will save it's data into InfluxDB.

Note : The configuration of Grafana, InfluxDB and Telegraf is commonly known on the internet as the TIG stack.


The first part is to Install the InfluxDB2 service and create the data source in Grafana.

The install commands for your OS are at

For these instructions, I have chosen InfluxDB v2.1.1 version and the Ubuntu & Debian platform.

wget -qO- | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdb.gpg > /dev/null
export DISTRIB_ID=$(lsb_release -si); export DISTRIB_CODENAME=$(lsb_release -sc)
echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg]${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list > /dev/null
sudo apt-get update && sudo apt-get install influxdb2

The InfluxDB service is usually not started by default. We can start it and check its status.

sudo service influxdb start
sudo service influxdb status

We can now visit the InfluxDB UI at the address http://[Your Domain name or IP address]:8086

If your InfluxDB web address is accessible from the internet, then I recommend setting some firewall rules using the methods available to you.

When you first access the InfluxDB UI, it will require you to create a user and password to log in.

After logging in, we need to create a user, password, organization and bucket name.

I have named my organization sbcode and my bucket telegraf. You username and password for accessing InfluxDB can also be anything you want.

Also, you can name your organization anything you like, just remember it though, since you will need it when creating the data source in the Grafana UI.

Using the InfluxDB UI, make sure you have a bucket named telegraf, a scraper named anything you like, and a access token to allow the InfluxDB data source to connect with.


Ideally you should create a specific user with read only permissions that you can use to connect to InfluxDB from Grafana, and use the token for that user instead.


If your server is on the public internet, and you haven't configured a dedicated firewall, it may be accessible via the address http://[your domain or ip]:8086/

You can restrict access to port 8086 using iptables.

iptables -A INPUT -p tcp -s <domain name or ip of allowed host> --dport 8086 -j ACCEPT
iptables -A INPUT -p tcp --dport 8086 -j DROP
iptables -L

InfluxDB Open Source (OSS) Metrics Template