Install InfluxDB | Quick Guide to Linux InfluxDB Install

Technicians executing precise commands achieving seamless install influxdb Ubuntu Servers

As we continue to improve the data storage and retrieval systems at IOFLOOD, we evaluated the best usages an InfluxDB install can offer for handling data management. To assist our customers enhance data analysis capabilities of their dedicated servers, we have customized this article functional methods to install InfluxDB Ubuntu 22.04, and other Linux distributions.

In this guide, we will navigate the process of installing InfluxDB on your Linux system. We are going to provide you with installation instructions for Debian, Ubuntu, CentOS, and AlmaLinux, delve into how to compile InfluxDB from the source, and install a specific version. Finally, we will show you how to use the InfluxDB command and ascertain that the correctly installed version is in use.

Let’s get started with the step-by-step InfluxDB installation on your Linux system!

TL;DR: How Do I Install InfluxDB Ubuntu 22.04 and Centos?

You can install InfluxDB on Linux using the package manager for your distribution. For example, on Ubuntu, you can use the command sudo apt-get install influxdb.

sudo apt-get update
sudo apt-get install influxdb

# Output:
# 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 0 not upgraded.
# Need to get 0 B/2,749 kB of archives.
# After this operation, 8,192 kB of additional disk space will be used.
# Selecting previously unselected package influxdb.
# (Reading database ... 160837 files and directories currently installed.)
# Preparing to unpack .../influxdb_1.8.3-1_amd64.deb ...
# Unpacking influxdb (1.8.3-1) ...
# Setting up influxdb (1.8.3-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.
# influxdb.service is a disabled or a static unit, not starting it.

This command will install InfluxDB on your Ubuntu system. However, the installation process may vary depending on your Linux distribution. This is just a basic way to install InfluxDB on Linux, but there’s much more to learn about installing and using InfluxDB. Continue reading for more detailed information and advanced usage scenarios.

Why Install InfluxDB on Linux?

InfluxDB is an open-source time series database developed by InfluxData. It is written in Go and optimized for fast, high-availability storage and retrieval of time series data in fields such as operations monitoring, application metrics, Internet of Things sensor data, and real-time analytics.

Now, let’s dive into how to install InfluxDB on your Linux system using common package managers like apt and yum.

Install InfluxDB Ubuntu and Debian with apt

If you’re using a Debian-based distribution like Ubuntu, you can install InfluxDB using the apt package manager. Here’s how:

  1. Update the package lists for upgrades and new package installations:
sudo apt-get update

# Output:
# Hit:1 http://security.ubuntu.com/ubuntu focal-security In Progress
# Hit:2 http://archive.ubuntu.com/ubuntu focal In Progress
# Reading package lists... Done
  1. Install InfluxDB:
sudo apt-get install influxdb

# Output:
# 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 0 not upgraded.
# Need to get 0 B/2,749 kB of archives.
# After this operation, 8,192 kB of additional disk space will be used.
# Selecting previously unselected package influxdb.
# (Reading database ... 160837 files and directories currently installed.)
# Preparing to unpack .../influxdb_1.8.3-1_amd64.deb ...
# Unpacking influxdb (1.8.3-1) ...
# Setting up influxdb (1.8.3-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.
# influxdb.service is a disabled or a static unit, not starting it.

This command will install InfluxDB on your Debian or Ubuntu system.

InfluxDB Install on CentOS, RHEL with yum

If you’re using a Red Hat-based distribution like CentOS, you can install InfluxDB using the yum package manager. Here’s how:

  1. Add the InfluxData repository with the following command:
cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL $releasever
baseurl = https://repos.influxdata.com/rhel/$releasever/$basearch/stable
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
enabled = 1
EOF

# Output:
# [influxdb]
# name = InfluxDB Repository - RHEL $releasever
# baseurl = https://repos.influxdata.com/rhel/$releasever/$basearch/stable
# gpgcheck = 1
# gpgkey = https://repos.influxdata.com/influxdb.key
# enabled = 1
  1. Install InfluxDB:
sudo yum install influxdb

# Output:
# Loaded plugins: fastestmirror
# Loading mirror speeds from cached hostfile
# Resolving Dependencies
# --> Running transaction check
# ---> Package influxdb.x86_64 0:1.8.3-1 will be installed
# --> Finished Dependency Resolution
# 
# Dependencies Resolved
# 
# ================================================================================
#  Package            Arch             Version           Repository         Size
# ================================================================================
# Installing:
#  influxdb           x86_64           1.8.3-1           influxdb           62 M
# 
# Transaction Summary
# ================================================================================
# Install  1 Package
# 
# Total download size: 62 M
# Installed size: 217 M
# Downloading packages:
# Running transaction check
# Running transaction test
# Transaction test succeeded
# Running transaction
#   Installing : influxdb-1.8.3-1.x86_64                                      1/1 
#   Verifying  : influxdb-1.8.3-1.x86_64                                      1/1 
# 
# Installed:
#   influxdb.x86_64 0:1.8.3-1                                                       
# 
# Complete!

This command will install InfluxDB on your CentOS, RHEL, or Fedora system. Now you’re ready to start using InfluxDB!

Install InfluxDB from Source Code

In some cases, you might prefer to install InfluxDB from source code. This gives you more control over the installation and allows you to modify the code if needed. Here’s how to do it:

  1. First, clone the InfluxDB repository from GitHub:
git clone https://github.com/influxdata/influxdb.git

# Output:
# Cloning into 'influxdb'...
# remote: Enumerating objects: 281, done.
# remote: Counting objects: 100% (281/281), done.
# remote: Compressing objects: 100% (196/196), done.
# remote: Total 281 (delta 146), reused 116 (delta 74), pack-reused 0
# Receiving objects: 100% (281/281), 105.01 KiB | 2.62 MiB/s, done.
# Resolving deltas: 100% (146/146), done.
  1. Then, navigate to the cloned directory and build InfluxDB:
cd influxdb
make

# Output:
# GO111MODULE=on go run github.com/gobuffalo/packr/v2/packr2
# GO111MODULE=on go install -ldflags='-s -w' ./...
# go: finding module for package github.com/influxdata/influxdb/v2/cmd/influxd
# go: found github.com/influxdata/influxdb/v2/cmd/influxd in github.com/influxdata/influxdb/v2 v2.0.0-beta.16
# ...

This will install InfluxDB from the source code on your Linux system.

Different Versions of InfluxDB Install

InfluxDB has different versions, each with its own features and compatibilities. You might need to install a specific version for certain use cases.

Install InfluxDB from Source

To install a specific version from the source, you can use git checkout to switch to the desired version before building InfluxDB:

git checkout v1.8.3
make

# Output:
# HEAD is now at dnm... v1.8.3
# GO111MODULE=on go run github.com/gobuffalo/packr/v2/packr2
# GO111MODULE=on go install -ldflags='-s -w' ./...
# ...

Install InfluxDB Ubuntu with Package Managers

If you’re using a package manager, you can specify the version during installation. For apt, you can do:

sudo apt-get install influxdb=1.8.3

# Output:
# Reading package lists... Done
# Building dependency tree
# Reading state information... Done
# influxdb is already the newest version (1.8.3-1).
# 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

For yum, you can do:

sudo yum install influxdb-1.8.3

# Output:
# Loaded plugins: fastestmirror
# Loading mirror speeds from cached hostfile
# Resolving Dependencies
# --> Running transaction check
# ---> Package influxdb.x86_64 0:1.8.3-1 will be installed
# --> Finished Dependency Resolution
# Dependencies Resolved
# ================================================================================
#  Package            Arch             Version           Repository         Size
# ================================================================================
# Installing:
#  influxdb           x86_64           1.8.3-1           influxdb           62 M
# Transaction Summary
# ================================================================================
# Install  1 Package
# Total download size: 62 M
# Installed size: 217 M
# Downloading packages:
# Running transaction check
# Running transaction test
# Transaction test succeeded
# Running transaction
#   Installing : influxdb-1.8.3-1.x86_64                                      1/1 
#   Verifying  : influxdb-1.8.3-1.x86_64                                      1/1 
# Installed:
#   influxdb.x86_64 0:1.8.3-1
# Complete!

Version Comparison

Different InfluxDB versions offer different features. Here’s a comparison of some major versions:

VersionKey FeaturesCompatibility
1.7First stable release, basic time series database featuresCompatible with all modern Linux distributions
1.8Improved query performance, added SQL-like syntaxCompatible with all modern Linux distributions
2.0Introduced InfluxDB Cloud, added Flux language supportCompatible with all modern Linux distributions

Using and Verifying InfluxDB

After installing InfluxDB, you can verify its installation and start using it.

Verifying the Installation

You can verify the InfluxDB installation by checking its version:

influx -version

# Output:
# InfluxDB shell version: 1.8.3

This command will show the installed InfluxDB version, confirming a successful installation.

Basic Usage

You can start using InfluxDB by starting the InfluxDB service and using the influx command to interact with the database:

sudo service influxdb start
influx

# Output:
# Connected to http://localhost:8086 version 1.8 .3
# InfluxDB shell version: 1.8.3
# >

This will start the InfluxDB service and open the InfluxDB shell where you can run InfluxDB commands.

Now you’re ready to explore more advanced InfluxDB features and use cases!

Alternative Time Series Databases

While InfluxDB is a powerful tool for handling time series data, it’s not the only player in the game. There are other databases designed for similar purposes, such as TimescaleDB and Prometheus. Let’s take a closer look at these alternatives.

TimescaleDB: A PostgreSQL Extension for Time Series

TimescaleDB is an open-source database designed to make SQL scalable for time-series data. It’s not a separate database engine, but rather an extension of PostgreSQL. This means that in addition to time-series data functionality, it also provides all the benefits of a full-featured relational database.

To install TimescaleDB on Ubuntu, you can use the following commands:

# Add the APT repository
sudo add-apt-repository ppa:timescale/timescaledb-ppa
sudo apt-get update

# Install TimescaleDB
sudo apt-get install timescaledb-postgresql-12

# Output:
# Reading package lists... Done
# Building dependency tree
# Reading state information... Done
# The following NEW packages will be installed:
#   timescaledb-postgresql-12
# 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
# Need to get 0 B/1,024 kB of archives.
# After this operation, 4,096 kB of additional disk space will be used.
# Selecting previously unselected package timescaledb-postgresql-12.
# (Reading database ... 160837 files and directories currently installed.)
# Preparing to unpack .../timescaledb-postgresql-12_1.7.4~ubuntu20.04_amd64.deb ...
# Unpacking timescaledb-postgresql-12 (1.7.4~ubuntu20.04) ...
# Setting up timescaledb-postgresql-12 (1.7.4~ubuntu20.04) ...

TimescaleDB offers automatic partitioning across time and space (partitioning key), as well as full SQL support. However, it might be overkill if you don’t need the relational capabilities of PostgreSQL.

Prometheus: A Database for Monitoring Systems and Time Series

Prometheus is an open-source monitoring system and time series database. It features a multi-dimensional data model, a flexible query language, and autonomous single server nodes. It’s particularly well-suited for monitoring tasks, where it can gather and store time series data from a wide range of sources.

To install Prometheus on Ubuntu, use the following commands:

# Download Prometheus
wget https://github.com/prometheus/prometheus/releases/download/v2.26.0/prometheus-2.26.0.linux-amd64.tar.gz

# Extract the tarball
tar xvf prometheus-2.26.0.linux-amd64.tar.gz

# Output:
# prometheus-2.26.0.linux-amd64/
# prometheus-2.26.0.linux-amd64/prometheus
# ...

Prometheus is a powerful tool for time series data, but it’s primarily designed for monitoring purposes. It’s not intended to serve as a general-purpose database, so it might not be the best choice for applications outside of monitoring.

Choosing the Right Tool

InfluxDB, TimescaleDB, and Prometheus each have their strengths and weaknesses. The right tool depends on your specific needs:

  • If you need a powerful, easy-to-use time series database and don’t require relational capabilities, InfluxDB is a great choice.
  • If you need a full-featured relational database in addition to time series functionality, TimescaleDB is worth considering.
  • If you’re primarily interested in monitoring, Prometheus might be the best option.

Remember, the best tool is the one that best fits your needs. It’s worth taking the time to understand the options before making a decision.

Troubleshooting InfluxDB Install Issues

Even with the best of guides, you might encounter some issues when installing InfluxDB on Linux. Here are some common problems and their solutions.

InfluxDB Fails to Start

If InfluxDB fails to start after installation, it might be due to a configuration issue. Check the InfluxDB logs for any error messages:

journalctl -u influxdb.service

# Output:
# -- Logs begin at Thu 2021-04-01 14:00:02 UTC, end at Thu 2021-04-01 14:00:49 UTC. --
# Apr 01 14:00:15 ubuntu systemd[1]: Started InfluxDB is an open-source, distributed, time series database.
# Apr 01 14:00:15 ubuntu influxd[1234]: ts=2021-04-01T14:00:15.257308Z lvl=info msg="InfluxDB starting" log_id=0S1W8PGl000 version=1.8.3 branch=1.8 commit=657e183c64
# ...

The logs will provide more information about what might be causing the problem. If you see an error related to a configuration file, make sure the file exists and has the correct permissions.

InfluxDB Service Not Found

If your system can’t find the InfluxDB service, it may not have been installed correctly. Try reinstalling InfluxDB and make sure the installation process completes without errors.

InfluxDB Command Not Found

If your system can’t find the influx command, it might not be in your PATH. Check your PATH with the following command:

echo $PATH

# Output:
# /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

If the directory where InfluxDB is installed (usually /usr/bin or /usr/local/bin) is not in your PATH, you can add it with the following command:

export PATH=$PATH:/path/to/influxdb

Replace /path/to/influxdb with the actual directory where InfluxDB is installed.

Considerations When Installing InfluxDB

When installing InfluxDB, there are a few things you should keep in mind:

  • Hardware Requirements: InfluxDB requires at least 1GB of RAM and 50GB of hard drive space. Make sure your system meets these requirements before installing InfluxDB.
  • Operating System Compatibility: InfluxDB is compatible with most modern Linux distributions. However, if you’re using an older or less common distribution, you might need to install InfluxDB from source.
  • InfluxDB Versions: Different versions of InfluxDB offer different features. Make sure to install the version that best fits your needs. You can check the official documentation for more information on each version.

Understanding Time Series Databases

A time series database (TSDB) is a software system optimized to handle data organized by time. Time series data, or data that is indexed by time, is found in many places – from system and application metrics to IoT devices and stock market data.

Why Use a Time Series Database?

Time series databases are built specifically to handle metrics and events or measurements that are time-stamped. A TSDB is optimized for handling data that can be denoted as a sequence of time, which is the case with metrics coming from IoT devices, stocks, and system metrics.

curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'

The above command writes a time series data point into InfluxDB. ‘cpu_load_short’ is the measurement name, ‘host’ and ‘region’ are tags, ‘value’ is the field, and the trailing number is a timestamp for the data.

Why Choose InfluxDB?

InfluxDB is a popular open-source time series database developed by InfluxData that’s known for its high-performance querying and storage. It’s written in Go and optimized for fast, high-availability storage and retrieval of time series data in fields such as operations monitoring, application metrics, IoT sensor data, and real-time analytics.

InfluxDB stands out for several reasons:

  • Ease of use: InfluxDB requires no external dependencies, supports SQL-like query language, and offers easy installation and setup procedures.
  • Performance: InfluxDB is designed to handle high write and query loads, making it suitable for storing and analyzing large amounts of time series data.
  • Scalability: InfluxDB can store billions of data points, making it a good choice for large-scale data storage.

InfluxDB is not the only time series database available, but its combination of performance, ease of use, and features make it a popular choice among developers and administrators dealing with time series data.

Practical Uses of Time Series Databases

Time series databases, including InfluxDB, play a crucial role in data analysis and machine learning. The ability to efficiently store and query temporal data is key to many modern data analysis tasks, ranging from trend forecasting to anomaly detection. Machine learning models often rely on time series data to predict future events based on historical patterns.

For instance, consider a machine learning model designed to predict server load in a data center. By feeding this model with time series data from InfluxDB, which captures the server load at regular intervals, the model can learn the patterns and make accurate predictions.

# Sample Python code to use InfluxDB data with a machine learning model
from influxdb import InfluxDBClient
from sklearn.linear_model import LinearRegression

# Connect to InfluxDB
client = InfluxDBClient(host='localhost', port=8086)
client.switch_database('mydb')

# Query to fetch the last 1000 data points of server load
data = client.query('SELECT value FROM cpu_load_short WHERE host=server01 ORDER BY time DESC LIMIT 1000')

# Prepare data for the model
X = data.index.values.reshape(-1, 1) # Time values
y = data['value'].values # Server load values

# Train the model
model = LinearRegression()
model.fit(X, y)

# Now the model can predict server load based on the time
predicted_load = model.predict([[1622527200]]) # Predict server load at a specific time

# Output:
# array([0.645])

In this code, we use the InfluxDB Python client to fetch data from InfluxDB, and then we use this data to train a simple linear regression model. The model can then predict the server load at a specific time.

Further Exploring Uses of InfluxDB

InfluxDB offers several features that make it easy to ingest data and optimize queries. For example, it supports a variety of data ingestion methods, including HTTP, TCP, and UDP. It also provides a SQL-like query language that makes it easy to fetch and analyze data.

InfluxDB is also designed to optimize query performance. It automatically indexes data by time and tags, which speeds up query execution. It also provides functions for aggregating and transforming data, which can help reduce the amount of data that needs to be transferred and processed.

# Sample InfluxDB query to fetch the average server load over the last hour
influx -database 'mydb' -execute 'SELECT MEAN(value) FROM cpu_load_short WHERE host=server01 AND time > now() - 1h'

# Output:
# name: cpu_load_short
# time mean
# ---- ----
# 0    0.645

This command fetches the average server load over the last hour. By using the MEAN function, InfluxDB can calculate the average server load on the server side, reducing the amount of data that needs to be transferred.

Further Info: InfluxDB Install and Time Series

To deepen your understanding of InfluxDB and its applications in time series data management, consider the following resources:

  1. InfluxDB Documentation: The official InfluxDB documentation is a comprehensive resource covering everything from basic installation to advanced features.

  2. InfluxDB and Grafana Tutorial: This tutorial provides a hands-on introduction to using InfluxDB with Grafana, a popular data visualization tool.

  3. Time Series Databases Courses: This course offers a broad overview of time series databases, including InfluxDB.

Recap: Streamlined InfluxDB Install

In this comprehensive guide, we’ve navigated the process of installing InfluxDB, a powerful time series database, on Linux systems. We’ve demystified the installation process, making it accessible for beginners and experts alike.

We began with the basics, demonstrating how to install InfluxDB on Linux systems using package managers like apt and yum. We then ventured into more advanced territory, discussing how to install InfluxDB from source code and how to install specific versions of the software. We also addressed common issues you might encounter during the installation process and provided practical solutions.

In addition to InfluxDB, we explored alternative time series databases, such as TimescaleDB and Prometheus. Each of these databases has its own strengths and weaknesses, and the right choice depends on your specific needs and the nature of your data.

Here’s a brief comparison of these time series databases:

DatabaseEase of InstallationFlexibilityUse Case
InfluxDBHighHighGeneral-purpose time series data
TimescaleDBModerateHighTime series data in PostgreSQL environment
PrometheusModerateModerateMonitoring and alerting

Whether you’re installing InfluxDB for the first time or looking to brush up on your skills, we hope this guide has provided you with valuable insights and practical knowledge. Armed with this information, you should be well-equipped to install InfluxDB on Linux and explore alternative time series databases.

The world of time series databases is vast and rapidly evolving. With tools like InfluxDB, TimescaleDB, and Prometheus, you can handle time series data with efficiency and ease. Happy data exploring!