Categories: LinuxUbuntu

How to Install InfluxDB on Ubuntu 22.04

InfluxDB is an open source database with high read and write speed developed by InfluxData. It is written in Go and is designed for developers who create time series-based applications. It can store large amounts of time series data and quickly perform real-time analysis on that data. You can install it on multiple operating systems and it supports a variety of client libraries.

In this post, we'll explain how to install InfluxDB on Ubuntu 22.04.

Requirements

  • A server running Ubuntu 22.04.
  • A root password is set up on your server.

First steps

First, update all system packages to the latest version using the following command:

apt update -y
apt upgrade -y

Once your system is up to date, use the following command to install any other dependencies you need:

apt install wget curl gnupg2 -y

After you have installed all dependencies, you can proceed with the installation of InfluxDB.

Install InfluxDB

By default, InfluxDB is not available in the default repository of Ubuntu 22.04. Therefore, you need to create a repository for InfluxDB.

First, add the InfluxDB GPG key with the following command:

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

Next, add the IngluxDB repository to the APT with the following command:

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" | tee /etc/apt/sources.list.d/influxdb.list > /dev/null

Next, update the repository cache and install InfluxDB with the following command:

apt update -y
apt install influxdb2

Once InfluxDB is installed, you can proceed to the next step.

Start InfluxDB service

By default, the InfluxDB service is managed by systemd. You can start and stop the InfluxDB service with the following command:

systemctl start influxdb
systemctl stop influxdb

To enable InfluxDB when you reboot the system, run the following command:

systemctl enable influxdb

To check the status of InfluxDB, run the following command:

systemctl status influxdb

You should get the following output:

? 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 14:35:23 UTC; 11s ago
       Docs: https://docs.influxdata.com/influxdb/
    Process: 12075 ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh (code=exited, status=0/SUCCESS)
   Main PID: 12076 (influxd)
      Tasks: 8 (limit: 4579)
     Memory: 45.2M
        CPU: 782ms
     CGroup: /system.slice/influxdb.service
             ??12076 /usr/bin/influxd

Dec 05 14:35:23 ubuntu2204 influxd-systemd-start.sh[12076]: ts=2022-12-05T14:35:23.568768Z lvl=info msg="Open store (end)" log_id=0e_gFea0000>
Dec 05 14:35:23 ubuntu2204 influxd-systemd-start.sh[12076]: ts=2022-12-05T14:35:23.568805Z lvl=info msg="Starting retention policy enforcemen>
Dec 05 14:35:23 ubuntu2204 influxd-systemd-start.sh[12076]: ts=2022-12-05T14:35:23.568818Z lvl=info msg="Starting precreation service" log_id>
Dec 05 14:35:23 ubuntu2204 influxd-systemd-start.sh[12076]: ts=2022-12-05T14:35:23.569835Z lvl=info msg="Starting query controller" log_id=0e>
Dec 05 14:35:23 ubuntu2204 influxd-systemd-start.sh[12076]: ts=2022-12-05T14:35:23.573680Z lvl=info msg="Configuring InfluxQL statement execu>
Dec 05 14:35:23 ubuntu2204 influxd-systemd-start.sh[12076]: ts=2022-12-05T14:35:23.580309Z lvl=info msg=Starting log_id=0e_gFea0000 service=t>
Dec 05 14:35:23 ubuntu2204 influxd-systemd-start.sh[12076]: ts=2022-12-05T14:35:23.582658Z lvl=info msg=Listening log_id=0e_gFea0000 service=>
Dec 05 14:35:23 ubuntu2204 influxd-systemd-start.sh[12098]: Command "print-config" is deprecated, use the influx-cli command server-config to>
Dec 05 14:35:23 ubuntu2204 influxd-systemd-start.sh[12075]: InfluxDB started

At this point InfluxDB is started and listening on port 8086, you can check this with the following command:

ss -tunelp | grep 8086

You should see the following output:

tcp   LISTEN 0      4096                                *:8086             *:*    users:(("influxd",pid=12076,fd=10)) uid:998 ino:87540 sk:17 cgroup:/system.slice/influxdb.service v6only:0 <->                         

InfluxDB setup

By default InfluxDB is not configured. So you have to configure it via the command line.

influx setup

You will be prompted to set the admin user and password as shown below:

> Welcome to InfluxDB 2.0!
? Please type your primary username admin
? Please type your password ***********
? Please type your password again ***********
? Please type your primary organization name Howtoforge
? Please type your primary bucket name IT
? Please type your retention period in hours, or 0 for infinite 2
? Setup with these parameters?
  Username:          admin
  Organization:      Howtoforge
  Bucket:            IT
  Retention Period:  2h0m0s
 Yes
User Organization Bucket
admin Howtoforge IT

Access InfluxDB Web UI.

At this point InfluxDB is configured and listening on port 8086, you can verify this with the following command:

ss -antpl | grep 8086

You will get the following output:

LISTEN 0      4096               *:8086             *:*    users:(("influxd",pid=12076,fd=10))    

Now open your web browser and access the InfluxDB web UI using the URL http://your-server-ip:8086. You should see the login page of InfluxDB:

Enter your admin username and password and click the LOGIN button. On the following page, you should see the InfluxDB dashboard:

Conclusion

Congratulations. You have successfully installed InfluxDB on Ubuntu 22.04. You can now use InfluxDB in the production environment and manage it through a web-based interface.

Vitux Staff

Recent Posts

How to Install Magento 2 on AlmaLinux

Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…

1 year ago

How to Install ISPConfig Hosting Control Panel with Apache Web Server on Ubuntu 24.04

ISPConfig is an open-source control panel that allows users to manage multiple servers from a…

1 year ago

How to Test your Email Server (SMTP) Using the Telnet Command

As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…

1 year ago

Managing Network Interfaces and Settings on Ubuntu 24.04 with nmcli

Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…

2 years ago

Using Restic Backup on Ubuntu 24.04

Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…

2 years ago

Installing phpMyAdmin on Rocky Linux 9 and Securing it with Let’s Encrypt SSL

phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…

2 years ago