InfluxDB is an open-source time-series database. It is used for storage and retrieval of time series data in fields such as operation monitoring, operations metrics, internet of things sensor data, and real-time analytics. In this tutorial, we are going to learn how to install InfluxDB on Debian 11.
By default, InfluxDB uses the following network ports for communication.
- TCP port 8086 for client-server communication.
- TCP port 8088 for RPC service to perform backup and restore operations.
Why InfluxDB?
- It provides deep insight and analytics
- InfluxDB is optimized for developer productivity
- It has best UI which features dashboard, explorer and script editor.
- It has faster time to market. That is production is faster while usin influxDB.
- It is easy to build and easy to share templates.
Prerequisites
- You need to be root to perform tasks
- Have basic knowledge of terminal.
- Have Debian 11 server up and running.
Related Articles
Installing InfluxDB on Debian 11
1. Update system repositories
The first thing to do is to make sure that repositories are up to date. Updating repositories will enable you to avoid running into errors later.
$ sudo apt update && apt upgrade -y
2. Add InfluxDB repository to Ubuntu Repository
To install the stable latest version using apt, run the following command using curl.
Add key
$ wget -qO- https://repos.influxdata.com/influxdb.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdb.gpg > /dev/null
$ export DISTRIB_ID=$(lsb_release -si); export DISTRIB_CODENAME=$(lsb_release -sc)
3. Add Repository
$ echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg] https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list > /dev/null
Then update the system repositories again
$ sudo apt update
Get:5 https://repos.influxdata.com/debian bullseye InRelease [4739 B]
Hit:6 https://repos-droplet.digitalocean.com/apt/droplet-agent main InRelease
Get:7 http://deb.debian.org/debian bullseye-backports/main Sources.diff/Index [63.3 kB]
Get:8 http://deb.debian.org/debian bullseye-backports/main amd64 Packages.diff/Index [63.3 kB]
Get:9 http://deb.debian.org/debian bullseye-backports/main Translation-en.diff/Index [60.0 kB]
4. Install influxDB on Ubuntu 20.04
To install the latest stable version of InfluxDB we use the following command:
$ sudo apt install influxdb2
The following is the output you will get from the terminal.
Output.
The following NEW packages will be installed:
influxdb2 influxdb2-cli
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 114 MB of archives.
After this operation, 195 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://repos.influxdata.com/debian bullseye/stable amd64 influxdb2 amd64 2.1.1 [108 MB]
Get:2 https://repos.influxdata.com/debian bullseye/stable amd64 influxdb2-cli amd64 2.2.1 [5325 kB]
Fetched 114 MB in 2s (68.9 MB/s)
Selecting previously unselected package influxdb2.
(Reading database ... 25056 files and directories currently installed.)
Preparing to unpack .../influxdb2_2.1.1_amd64.deb ...
Unpacking influxdb2 (2.1.1) ...
Selecting previously unselected package influxdb2-cli.
Preparing to unpack .../influxdb2-cli_2.2.1_amd64.deb ...
Unpacking influxdb2-cli (2.2.1) ...
Setting up influxdb2 (2.1.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.
Setting up influxdb2-cli (2.2.1) ...
5. Configuring InfluxDB
In order to start using InfluxDB, we need to start and enable it.
# start InfluxDB
$ sudo systemctl start influxdb
# enable
$ sudo systemctl enable --now influxdb
# status
$ sudo systemctl status influxdb
# Status
● 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 2022-02-09 17:52:45 UTC; 43s ago
Docs: https://docs.influxdata.com/influxdb/
Process: 550 ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh (code=exited, status=0/SUCCESS)
Main PID: 555 (influxd)
Tasks: 7 (limit: 1132)
Memory: 111.2M
CPU: 735ms
CGroup: /system.slice/influxdb.service
└─555 /usr/bin/influxd
Feb 09 17:52:44 debian influxd-systemd-start.sh[555]: ts=2022-02-09T17:52:44.761167Z lvl=info msg="Open store (end)" log_id=0Z>
Feb 09 17:52:44 debian influxd-systemd-start.sh[555]: ts=2022-02-09T17:52:44.761210Z lvl=info msg="Starting retention policy e>
Feb 09 17:52:44 debian influxd-systemd-start.sh[555]: ts=2022-02-09T17:52:44.761247Z lvl=info msg="Starting precreation servic>
Feb 09 17:52:44 debian influxd-systemd-start.sh[555]: ts=2022-02-09T17:52:44.761304Z lvl=info msg="Starting query controller" >
Feb 09 17:52:44 debian influxd-systemd-start.sh[555]: ts=2022-02-09T17:52:44.766154Z lvl=info msg="Configuring InfluxQL statem>
Feb 09 17:52:44 debian influxd-systemd-start.sh[550]: InfluxDB API at http://localhost:8086/ready unavailable after 1 attempts>
Feb 09 17:52:45 debian influxd-systemd-start.sh[555]: ts=2022-02-09T17:52:45.084183Z lvl=info msg=Listening log_id=0ZZuh_gW000>
Feb 09 17:52:45 debian influxd-systemd-start.sh[555]: ts=2022-02-09T17:52:45.085334Z lvl=info msg=Starting log_id=0ZZuh_gW000 >
Feb 09 17:52:45 debian influxd-systemd-start.sh[550]: InfluxDB started
Feb 09 17:52:45 debian systemd[1]: Started InfluxDB is an open-source, distributed, time series database.
lines 1-22/22 (END)
Enable –now InfluxDB will ensure that InfluxDB starts every time the server is reloaded. We don’t need to reenable every time.
6. Enable Firewall settings
To ensure that we can access InfluxDB from outside, we need to enable TCP 8086 on the firewall.
To know more about how to enable firewall, read this article How to setup Ubuntu 20.04 Server for the first time
$ sudo ufw allow 8086/tcp
To check the status we use ufw enable and status command
$ sudo ufw enable
$ sudo ufw status
Status: active
To Action From
-- ------ ----
8086/tcp ALLOW Anywhere
8086/tcp (v6) ALLOW Anywhere (v6)
We can verify the version installed with the following command.
$ influx version
Influx CLI 2.2.1 (git: 31ac783) build_date: 2021-11-09T21:24:22Z
7. Setting up InfluxDB
Initial InfluxDB setup entails creating a default organization, user, bucket, and operator API token.
Setup InfluxDB through UI
- With InfluxDB running visit localhost:8086.
- Click get started
Set up initial user
- Enter a Username for your initial user.
- Enter a Password and Confirm Password for your user.
- Enter your initial Organization Name.
- Enter your initial Bucket Name.
- Click Continue.
Set up InfluxDB through Influx CLI
Begin CLI setup with the following command.
$ influx setup
- Enter a primary username.
- Enter a password for your user.
- Confirm your password by entering it again.
- Enter a name for your primary organization.
- Enter a name for your primary bucket.
- Enter a retention period for your primary bucket—valid units are nanoseconds (ns), microseconds (us or µs), milliseconds (ms), seconds (s), minutes (m), hours (h), days (d), and weeks (w). Enter nothing for an infinite retention period.
- Confirm the details for your primary user, organization, and bucket.
> Welcome to InfluxDB 2.0!
? Please type your primary username nextgentips
? Please type your password **********
? Please type your password again **********
? Please type your primary organization name nextgen
? Please type your primary bucket name example
? Please type your retention period in hours, or 0 for infinite 0
? Setup with these parameters?
Username: nextgentips
Organization: nextgen
Bucket: example
Retention Period: infinite
Yes
User Organization Bucket
nextgentips nextgen example
Conclusion
We have successfully installed InfluxDB on Debian 11. In case of any issue head over to InfluxDB documentation for clarification.