Install InfluxDB 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, the InfluxDB data source, a Telegraf agent and then collect data from some SNMP devices.

InfluxDB is a database useful for storing large amounts of timestamped 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 InfluxDB service and create the data source in Grafana.

The install commands for your OS are at


InfluxDB v2.0 is now available. Please install v1.8 since v2.0 is a significantly different process to setup and configure. All the documentation and InfluxDB related videos in this course use InfluxDB v1.8.

I am using Ubuntu 20.04

Check the available InfluxDB version in your apt cache.

sudo apt-cache policy influxdb

It will be the last stable version of InfluxDB

I am going to use a later version 1.8 of InfluxDB, so I will update the apt cache first.

I add the required information to the repository

wget -qO- | sudo apt-key add -
source /etc/lsb-release
echo "deb${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

then update and install

sudo apt update
sudo apt-cache policy influxdb
sudo apt install influxdb -y

then start the service check it's status is active and ensure it starts in case of reboot and

sudo systemctl start influxdb
sudo systemctl status influxdb
sudo systemctl enable influxdb

The InfluxDB will listen on port 8086, and if your server is on the internet, then depending on any existing firewall rules, anybody may be able to query the server using the url

http://[your domain name or ip]:8086/metrics

If you want to prevent direct internet access, then you can use iptables to only allow the port for localhost.

iptables -A INPUT -p tcp -s localhost --dport 8086 -j ACCEPT
iptables -A INPUT -p tcp --dport 8086 -j DROP

You have other options to secure your InfluxDB as well which are listed at


iptables settings will be lost in case of system reboot. You will need to reapply them manually,


install iptables-persistent

sudo apt install iptables-persistent

This will save your settings into two files called,



Any changes you make to the iptables configuration won't be auto saved to these persistent files, so if you want to update these files with any changes, then use the commands,

iptables-save > /etc/iptables/rules.v4

iptables-save > /etc/iptables/rules.v6

Next, start the InfluxDB prompt, create a Telegraf database and create a specific read only user for Grafana.

> create database telegraf
> show databases
> create user grafana with password 'password'
> grant READ on telegraf to grafana 
> show users
> show GRANTS for grafana
> quit


It may take several seconds to initially connect to the InfluxDB before you get the prompt

Now continue to add the InfluxDB Data Source as shown in the video.