I recently set up an old mid 2009 MacBook Pro with Ubuntu to give the hardware a second life as...

I recently set up an old mid 2009 MacBook Pro with Ubuntu to give the hardware a second life as a ioBroker home automation server. To store data, I decided to use the time series database InfluxDB in version 2.x. Here is a quick walk through of the steps I took to install InfluxDB on Ubuntu. Should be similar on most *nix derivatives.

Add GPG Key to verify the authenticity of the downloaded package.

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

Then setup the repo to download the Influxdb2 package using the following commands.

$ 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

Update the package cache the package information from the newly added influxdb repository.

$ sudo apt-get update

Now download and install the latest version by using the following command. This will install the influxdb2 package along with all its dependencies. Answer “y” if asked for.

$ sudo apt-get install influxdb2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
The following NEW packages will be installed:
  influxdb2 influxdb2-cli
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 98.2 MB of archives.
After this operation, 168 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

After the installation has finished, check the InfluxDB version with

$ influx version
Influx CLI 2.4.0 (git: 5c7c34f) build_date: 2022-08-18T19:26:48Z

Since the influxdb service is inactive after installation we need to start it by using the following command.

$ sudo systemctl start influxdb

Check the service’s status with

$ 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 Tue 2022-10-04 17:03:32 UTC; 18s ago
       Docs: https://docs.influxdata.com/influxdb/
    Process: 2304 ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh (code=exited, status=0/SUCCESS)
   Main PID: 2305 (influxd)
      Tasks: 8 (limit: 9097)
     Memory: 46.6M
        CPU: 1.169s
     CGroup: /system.slice/influxdb.service
             └─2305 /usr/bin/influxd

To have the service started upon reboot we have to explicitly enable this behaviour.

$ sudo systemctl enable influxdb

Finally, launch a web browser and enter http://<ip-address-of-server>:8086. You should be greeted with Influx’s welcome screen!

Hit “Get started” to finalize setting up InfluxDB2!

Leave a Reply

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