How to install InfluxDB on Ubuntu 22.04
How to install InfluxDB on Ubuntu 22.04

Installing InfluxDB On Ubuntu 22.04

This short tutorial will discuss how to install InfluxDB on the Ubuntu 22.04 Linux operating system. InfluxDB is an open-source time series database (TSDB) designed for fast, highly available storage and retrieval of time series data. InfluxDB is developed by the company InfluxData and it is written in the Go programming language.

InfluxDB is distributed under an open-source license, but the company also offers commercial extensions such as access controls for business customers within its root server and cloud services with graphical data analysis via a web interface.

InfluxDB Installation On Ubuntu 22.04

In this tutorial, we will use influxDB v2.5.1. The InfluxDB installation process will consist of several steps, namely:

1. Update System
2. Import the InfluxDB GPG key
3. Add APT repository
4. Installing InfluxDB on Ubuntu 22.04
5. Start and Enable the Influxdb service
6. Setup InfluxDB

The explanation of the installation process will be discussed in several sub-chapters below.

1. Update System

The first step to install InfluxDB is to update our local packages software. This task will cut down the installation time and it also helps prevent zero-day exploits against outdated software. We will use command line :

$ sudo apt update

Output :

ramans@infodiginet:~$ sudo apt update
[sudo] password for ramans: 
Hit:1 http://id.archive.ubuntu.com/ubuntu jammy InRelease 
Get:2 http://id.archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB] 
Get:3 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] 
Ign:4 http://download.webmin.com/download/repository sarge InRelease 
Hit:5 http://download.webmin.com/download/repository sarge Release 
Get:7 http://id.archive.ubuntu.com/ubuntu jammy-backports InRelease [99,8 kB]
Get:8 http://id.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [755 kB]
Get:8 http://id.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [755 kB]
Get:11 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [220 kB]
Get:8 http://id.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [755 kB]
Get:12 http://id.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [389 kB]
Get:13 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [522 kB]
Get:14 http://id.archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [169 kB] 
Get:15 http://id.archive.ubuntu.com/ubuntu jammy-updates/main amd64 DEP-11 Metadata [95,0 kB] 
Get:16 http://id.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [484 kB] 
Get:17 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [761 kB] 
Get:18 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 DEP-11 Metadata [258 kB]
Get:19 http://id.archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [7.324 B] 
Get:20 http://id.archive.ubuntu.com/ubuntu jammy-updates/multiverse i386 Packages [1.736 B] 
Get:21 http://id.archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:22 http://id.archive.ubuntu.com/ubuntu jammy-backports/main i386 Packages [3.288 B] 
Get:23 http://id.archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [3.324 B] 
Get:24 http://id.archive.ubuntu.com/ubuntu jammy-backports/main Translation-en [1.580 B] 
Get:25 http://id.archive.ubuntu.com/ubuntu jammy-backports/main amd64 c-n-f Metadata [272 B] 
Get:26 http://id.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [6.736 B] 
Get:27 http://id.archive.ubuntu.com/ubuntu jammy-backports/universe i386 Packages [5.192 B] 
Get:28 http://id.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 DEP-11 Metadata [11,7 kB]
Get:29 http://id.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 c-n-f Metadata [348 B]
Get:30 http://security.ubuntu.com/ubuntu jammy-security/main Translation-en [112 kB] 
Get:31 http://security.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [20,1 kB] s
Get:32 http://security.ubuntu.com/ubuntu jammy-security/main amd64 c-n-f Metadata [7.204 B] s
Get:33 http://security.ubuntu.com/ubuntu jammy-security/universe i386 Packages [481 kB] 
Get:34 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [622 kB] 
Get:35 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 DEP-11 Metadata [13,3 kB] 
Fetched 4.763 kB in 12s (399 kB/s) 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.

2. Import the InfluxDB GPG key

Since InfluxDB is not available through the default system repository, so we need to add it manually. However, the system has to ensure the packages getting from a particular repo are the same as they were released by its developers. And for that purpose, it needs the GPG Key.

$ wget -qO- https://repos.influxdata.com/influxdb.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdb.gpg > /dev/null

3. Adding InfluxDB APT repository

Then, we add the official InfluxDB repository, by using command line below which is automatically detect the version of our system.

$ export DISTRIB_ID=$(lsb_release -si); export DISTRIB_CODENAME=$(lsb_release -sc)
$ 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

4. Install InfluxDB on Ubuntu 22.04

4.1. Update System

We will do a system update again to refresh the InfluxDB package repository that we just added. We will do following command line :

$ sudo apt update

Output :

ramans@infodiginet:~$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease 
Hit:2 http://id.archive.ubuntu.com/ubuntu jammy InRelease 
Hit:3 http://id.archive.ubuntu.com/ubuntu jammy-updates InRelease 
Ign:4 http://download.webmin.com/download/repository sarge InRelease
Get:5 https://repos.influxdata.com/ubuntu jammy InRelease [7.013 B] 
Hit:6 http://id.archive.ubuntu.com/ubuntu jammy-backports InRelease 
Hit:7 http://download.webmin.com/download/repository sarge Release
Get:9 https://repos.influxdata.com/ubuntu jammy/stable i386 Packages [1.555 B]
Get:10 https://repos.influxdata.com/ubuntu jammy/stable amd64 Packages [2.712 B]
Fetched 11,3 kB in 3s (4.317 B/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.

4.2. Install InfluxDB on Ubuntu 22.04

After we have done all the requirements, then in this step, we will install InfluxDB.

$ sudo apt install influxdb2

Output :

ramans@infodiginet:~$ sudo apt install influxdb2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
influxdb2-cli
The following NEW packages will be installed:
influxdb2 influxdb2-cli
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Need to get 52,8 MB of archives.
After this operation, 122 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://repos.influxdata.com/ubuntu jammy/stable amd64 influxdb2 amd64 2.5.1-1 [46,7 MB]
Get:2 https://repos.influxdata.com/ubuntu jammy/stable amd64 influxdb2-cli amd64 2.5.0 [6.106 kB] 
Fetched 52,8 MB in 1min 3s (834 kB/s) 
Selecting previously unselected package influxdb2.
(Reading database ... 224203 files and directories currently installed.)
Preparing to unpack .../influxdb2_2.5.1-1_amd64.deb ...
Unpacking influxdb2 (2.5.1-1) ...
Selecting previously unselected package influxdb2-cli.
Preparing to unpack .../influxdb2-cli_2.5.0_amd64.deb ...
Unpacking influxdb2-cli (2.5.0) ...
Setting up influxdb2 (2.5.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.5.0) ...

On this stage, we have installed InfluxDB on Ubuntu 22.o4 LTS operating system successfully.

5. Start and Enable the Influxdb service

By default InfluxDB server service is not running automatically after installation was completed, so we need to start it up. And to let the InfluxDB database server service start automatically with the system boot we have to enable it using the given commands.

$ sudo systemctl restart influxdb
$ sudo systemctl enable influxdb
$ sudo systemctl status influxdb

Output :

ramans@infodiginet:~$ sudo systemctl enable influxdb
ramans@infodiginet:~$ sudo systemctl restart influxdb
ramans@infodiginet:~$ sudo systemctl status influxdb
● 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 Mon 2022-12-05 23:03:21 WIB; 9s ago
Docs: https://docs.influxdata.com/influxdb/
Process: 16948 ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh (code=exited, status=0/SUCCESS)
Main PID: 16949 (influxd)
Tasks: 8 (limit: 4584)
Memory: 54.1M
CPU: 543ms
CGroup: /system.slice/influxdb.service
└─16949 /usr/bin/influxd

Des 05 23:03:21 infodiginet influxd-systemd-start.sh[16949]: ts=2022-12-05T16:03:21.061255Z lvl=info msg="Starting retentio>
Des 05 23:03:21 infodiginet influxd-systemd-start.sh[16949]: ts=2022-12-05T16:03:21.061265Z lvl=info msg="Starting precreat>
Des 05 23:03:21 infodiginet influxd-systemd-start.sh[16949]: ts=2022-12-05T16:03:21.063898Z lvl=info msg="Starting query co>
Des 05 23:03:21 infodiginet influxd-systemd-start.sh[16949]: ts=2022-12-05T16:03:21.073866Z lvl=info msg="Configuring Influ>
Des 05 23:03:21 infodiginet influxd-systemd-start.sh[16962]: Command "print-config" is deprecated, use the influx-cli comma>
Des 05 23:03:21 infodiginet influxd-systemd-start.sh[16949]: ts=2022-12-05T16:03:21.091316Z lvl=info msg=Listening log_id=0>
Des 05 23:03:21 infodiginet influxd-systemd-start.sh[16949]: ts=2022-12-05T16:03:21.091422Z lvl=info msg=Starting log_id=0e>
Des 05 23:03:21 infodiginet influxd-systemd-start.sh[16973]: Command "print-config" is deprecated, use the influx-cli comma>
Des 05 23:03:21 infodiginet influxd-systemd-start.sh[16948]: InfluxDB started
Des 05 23:03:21 infodiginet systemd[1]: Started InfluxDB is an open-source, distributed, time series database.

 

6. Setting InfluxDB

At this stage, we will show the initial steps for setting up InfluxDb. There are two ways to do InfluxDb settings, namely: via the console and via the web interface. If we want to setup InfluxDB using OS console, we just hit the command line :

$ influx setup

Another way to setup InfluxDB is using InfluxDB web interface. We just hit URL on http://ipaddress_or_hostname:8086/. In this tutorial we will hit the url http://infodiginet:8086 as shown below.

influxDB setting up
influxDB v2.5.1 setting up

Conclusion

In this short tutorial, we have learned how to install InfluxDB on Ubuntu 22.04 Linux operating system. I hope this article will be helpful.

(Visited 88 times, 1 visits today)

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *