LinuxTutorialsUbuntu

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) that 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 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.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 20.04, 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

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 the 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 a Database on Influxdb.

Once the installation is complete and the 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 follows:

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 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!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button