How To Install InfluxDB on Ubuntu 20.04 LTS

Install InfluxDB on Ubuntu 20.04

In this tutorial, we will show you how to install InfluxDB on Ubuntu 20.04 LTS. For those of you who didn’t know, 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, and many more.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step by step installation of InfluxDB on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian based distribution like Linux Mint.

Install InfluxDB on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running these following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Installing InfluxDB on Ubuntu 20.04.

Now we add the InfluxDB repository to the Ubuntu system:

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

Next, we will continue to update the system and install and start the InfluxDB:

sudo apt update
sudo apt install influxdb

Once successfully installed, Start and enable the service to start on bootup:

sudo systemctl enable --now influxdb

Step 3. Configure InfluxDB.

The configuration file is located at /etc/influxdb/influxdb.conf:

nano /etc/influxdb/influxdb.conf
[http]
  # Determines whether HTTP endpoint is enabled.
  enabled = true

  # Determines whether the Flux query endpoint is enabled.
  flux-enabled = true

  # The bind address used by the HTTP service.
  bind-address = ":8086"

Step 4. Configure Firewall.

We will open port 8086. 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:

sudo ufw enable
sudo ufw allow 8086/tcp

Step 5. Connect and Create Database on Influxdb.

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

  • User name: ranty
  • Password : ratna
  • Database name : wahyuni

The command line is as follow :

curl -XPOST "http://localhost:8086/query" \
--data-urlencode "q=CREATE USER ranty WITH PASSWORD 'ratna' WITH ALL PRIVILEGES"
{"results":[{"statement_id":0}]}

Congratulations! You have successfully installed InfluxDB. Thanks for using this tutorial for installing InfluxDB on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you to check the official InfluxDB website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!