How to install InfluxDB on Ubuntu 20.04 LTS

How to Install InfluxDB on Ubuntu 20.04 LTS

On this article we will discuss how to install InfluxDB Open Source (OSS) edition on Ubuntu 20.04 LTS.

Introduction

InfluxDB is a time series database (TSDB) which is designed to handle high write and query loads, InfluxDB is developed by InfluxData and written in Go. InfluxDB is meant to be used as a backing store for any use case involving large amounts of timestamped data, including DevOps monitoring, application metrics, Internet of Things sensor data, and real-time analytics.

The initial release of InfluxDB was introduced on 24 September 2013, and the last stable release version is 1.8.0 which was released on 13 April 2020. When the article is written the Preview release for 2.0.0-beta.16 also was released on 7 August 2020. For this tutorial we are going to use the InfluxDB stable version 1.8.0 Open source edition which is running on single node.

InfluxDB

The key features of InfluxDB 1.8.0 (as mentioned on the InfluxDB official website) are :

  • Custom high performance datastore written specifically for time series data. The TSM engine allows for high ingest speed and data compression
  • Written entirely in Go. It compiles into a single binary with no external dependencies.
  • Simple, high performing write and query HTTP APIs.
  • Plugins support for other data ingestion protocols such as Graphite, collectd, and OpenTSDB.
  • Expressive SQL-like query language tailored to easily query aggregated data.
  • Tags allow series to be indexed for fast and efficient queries.
  • Retention policies efficiently auto-expire stale data.
  • Continuous queries automatically compute aggregate data to make frequent queries more efficient.

InfluxDB Installation on Ubuntu 20.04 LTS

Prerequisite

Installation of the InfluxDB package on Ubuntu Linux operating system require root or an ordinary account with sudo privileges, Good internet connection, and sufficient disk space.

Installation Step

1. Add InfluxDB repository

We have to add the InfluxDB repository to our system. For this purpose, just hit, the command line below :

ramans@otodiginet:~$ wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
ramans@otodiginet:~$ source /etc/lsb-release
ramans@otodiginet:~$ echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
InfluxDB repository

2. Install InfluxDB

After InfluxDB repository was added to the system with no error, then we will continue to update the system and the install and start the InfluxDB. Please find the command lines below for this step.

ramans@otodiginet:~$ sudo apt-get update
ramans@otodiginet:~$ sudo apt-get install influxdb
ramans@otodiginet:~$ sudo service influxdb start

The output will be as follow :

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
influxdb
0 upgraded, 1 newly installed, 0 to remove and 230 not upgraded.
Need to get 0 B/63.5 MB of archives.
After this operation, 172 MB of additional disk space will be used.
Selecting previously unselected package influxdb.
(Reading database … 224856 files and directories currently installed.)
Preparing to unpack …/influxdb_1.8.2-1_amd64.deb …
Unpacking influxdb (1.8.2-1) …
Setting up influxdb (1.8.2-1) …
Created symlink /etc/systemd/system/influxd.service → /lib/systemd/system/influxdb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/influxdb.service → /lib/systemd/system/influxdb.service.
Processing triggers for man-db (2.9.1-1)
InfluxDB installation
InfluxDB start service
InfluxDB start service

3. Verify the authenticity of downloaded binary (optional)

Due to the security reasons, by using gpg command line, we will verify the signature of our InfluxDB. Here are several steps for verifying he installaion.

  1. Download and import InfluxData’s public key:
    curl -sL https://repos.influxdata.com/influxdb.key | gpg --import
  2. Download the signature file for the release by adding .asc to the download URL. For example:
    wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.0_linux_amd64.tar.gz.asc
  3. Verify the signature with gpg –verify:
    gpg --verify influxdb-1.8.0_linux_amd64.tar.gz.asc influxdb-1.8.0_linux_a
InfluxDB verifying

Checking InfluxDB service, by submitting command line :

ramans@otodiginet:~$ sudo systemctl status influxdb

output will be :

ramans@otodiginet:~$ sudo 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 Wed 2020-09-16 21:13:33 PDT; 7s ago
Docs: https://docs.influxdata.com/influxdb/
Main PID: 7178 (influxd)
Tasks: 13 (limit: 4624)
Memory: 9.7M
CGroup: /system.slice/influxdb.service
└─7178 /usr/bin/influxd -config /etc/influxdb/influxdb.conf
Sep 16 21:13:34 otodiginet influxd[7178]: ts=2020-09-17T04:13:34.000518Z lvl=info msg="Starti>
Sep 16 21:13:34 otodiginet influxd[7178]: ts=2020-09-17T04:13:34.000537Z lvl=info msg="Starti>
Sep 16 21:13:34 otodiginet influxd[7178]: ts=2020-09-17T04:13:34.000559Z lvl=info msg="Starti>
Sep 16 21:13:34 otodiginet influxd[7178]: ts=2020-09-17T04:13:34.000572Z lvl=info msg="opened>
Sep 16 21:13:34 otodiginet influxd[7178]: ts=2020-09-17T04:13:34.000583Z lvl=info msg="Auth i>
Sep 16 21:13:34 otodiginet influxd[7178]: ts=2020-09-17T04:13:34.001203Z lvl=info msg="Listen>
Sep 16 21:13:34 otodiginet influxd[7178]: ts=2020-09-17T04:13:34.001446Z lvl=info msg="Storin>
Sep 16 21:13:34 otodiginet influxd[7178]: ts=2020-09-17T04:13:34.001526Z lvl=info msg="Starti>
Sep 16 21:13:34 otodiginet influxd[7178]: ts=2020-09-17T04:13:34.002607Z lvl=info msg="Sendin>
Sep 16 21:13:34 otodiginet influxd[7178]: ts=2020-09-17T04:13:34.004527Z lvl=info msg="Listen>

4. Configuring InfluxDB

The local configuration file of InfluxDB is located on /etc/influxdb/influxdb.conf file, we could modify this file if we want to change. We will use this file to launch the InfluxDB on our system. Use the command line below to point the configuration file.

ramans@otodiginet:~$ influxd -config /etc/influxdb/influxdb.conf

5. Open influxDB service ports on the firewall

By default, InfluxDB uses the following network ports: TCP port 8086 is used for client-server communication over InfluxDB’s HTTP API and TCP port 8088 is used for the RPC service for backup and restore.

We will enable this ports for external connection to InfluxDB, we will submit command line below :

ramans@otodiginet:~$ sudo ufw enable
Firewall is active and enabled on system startup
ramans@otodiginet:~$ sudo ufw allow 8086/tcp
Rule added
Rule added (v6)

Connect and Create Database on Influxdb

After the installation and configuration of InfluxDB was done, we will try to connect to InfluxDB and creating a new user and database.

  • User name : otodiginet
  • Password : stongpassword and
  • Database name : otodiginet_DB

The command line is as follow :

ramans@otodiginet:~$ curl -XPOST "http://localhost:8086/query" \
--data-urlencode "q=CREATE USER otodiginet WITH PASSWORD 'strongpassword' WITH ALL PRIVILEGES"
{"results":[{"statement_id":0}]} 
InfluxDB create user
ramans@otodiginet:~$ influx -username 'otodiginet' -password 'strongpassword'
Connected to http://localhost:8086 version 1.8.2
InfluxDB shell version: 1.8.2
CREATE DATABASE otodiginet_DB
SHOW DATABASES
name: databases
name
_internal
otodiginet_DB
InfluxDB create and show Db

Conclusion

So far, we have successfully done install the InfluxDB on Ubuntu 20.04 LTS, and also create user and database on it. As we know InfluxDB is also an integral part of TIG Stack (Telegraf, InfluxDB and Grafana). Drop your comment on comment dialogue box for our improvement.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *