Install the InfluxDB Time-Series Database on Ubuntu Server 22.04

InfluxDB is a time-series database that is, well, optimized for time-series data. For those who aren’t certain what time-series data is, think about them as a collection of data that is collected over consistent intervals of time.
Time-series data is useful for things like commodity prices, stock prices, housing prices (over a period of time), weather, sales data, patient health metrics, and more. This type of data allows admins, managers, developers, and other user types to measure and analyze change, which can be very useful in forecasting trends and other measurables.
In other words, it’s quite valuable.
Time-series databases are used for operations monitoring, application metrics, IoT sensor data, real-time analytics, and much more.
To find out more about time-series databases, make sure to check out “What Are Time Series Databases, and Why Do You Need Them?”
Chances are pretty good, at some point in time, you’re business or your application will require the use of a time-series database. When that time comes, you’ll want to be ready for it. That’s why I’m here to walk you through the installation of the time-series database, InfluxDB. I’m going to demonstrate installing the open-source version of InfluxDB on Ubuntu Server 20.04, as that is one of the most widely used distributions deployed on cloud hosts around the world.
InfluxDB includes features such as:
- RESTful API
- Built on an SQL-like query language, called InfluxQL
- Client libraries for languages like C#, Go, Java, JavaScript, Kotlin, Node.js, PHP, Python, R, and more
- Series cardinality and high throughput
- Batch and streaming to inget and join data
- Flexible storage
- High availability that can be run on three clouds, four continents, and 20 regions
- Write data with AWS Lambda or InfluxDB CLI
- Run Flux scripts natively and view results in VS Code
- Connectors to Grafana, Google Data Studio, and PTC ThingWorkx
InfluxDB is a great choice for any application that requires high performance and storage at scale. If this has piqued your interest, let’s get to the installation of this fantastic time-series database.
What You’ll Need
The only things you’ll need for this are a running instance of Ubuntu Server 22.04 and a user with sudo privileges. Your Ubuntu instance can be local, in a data center, or hosted via a third-party cloud provider.
Make sure your instance of Ubuntu Server is up to date and fully patched against known vulnerabilities. To do that, make sure you run the following two commands:
1 2 |
sudo apt-get update sudo apt-get upgrade -y |
If the kernel is upgraded, you’ll need to reboot the server so the changes will take effect. To reboot the server, issue the command:
1 |
sudo reboot |
Installing InfluxDB
The first thing we must do is download the official InfluxDB GPG key with the following command:
1 |
wget -q https://repos.influxdata.com/influxdata-archive_compat.key |
Install the key with:
1 |
echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c influxdata-archive_compat.key' | sha256sum -c && cat influxdata-archive_compat.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null |
Next, add the required repository with the following command:
1 |
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list |
Once you’ve added the key, update apt sources with the command:
1 |
sudo apt-get update |
Finally, install InfluxDB with:
1 |
sudo apt-get install influxdb2 |
With the installation complete, start and enable the service with the command:
1 |
sudo systemctl enable --now influxdb |
I ran into an instance where InfluxDB refused to enable. To resolve that issue, I rebooted the server once again and all was fine. You can check on the status with:
1 |
sudo systemctl status influxdb |
You should see it listed as active (running).
Finally, you’ll need to open the required firewall port with the command:
1 |
sudo ufw allow 8086/tcp |
Access the Web-Based Portal
Open a web browser and point it to http://SERVER:8086 (where SERVER is either the IP address or domain of the hosting server). You’ll be greeted by a Get Started button (Figure 1).
-
Figure 1: The InfluxDB Get Started button is where you begin.
Click that button and you’ll then be required to create an initial user (Figure 2).
-
Figure 2: Creating your first user for InfluxDB..
Fill out all of the required information and click Continue.
In the resulting window (Figure 3), you’ll be presented with an API token. Make sure you copy and save that token somewhere safe because it enables superuser privileges.
-
Figure 3: Make sure to copy and paste the token for later use.
You can then click either Quick Start if you’re new to InfluxDB or click Advanced if you’re familiar with the database. If you click Quick Start, InfluxDB will automatically set up local metric collection and dump you right into the main window (Figure 4), where you can get to work with the database.
-
Figure 4: The InfluxDB Get Started window is a great place to learn more about how to use your new database.
If you’re unfamiliar with InfluxDB, I would highly recommend visiting each of the Useful Links listed in the main window.
And that’s the basics of getting InfluxDB up and running on Ubuntu Server 20.04. This powerful time-series database will come in very useful for your business and the data it depends on.