How to Install and Setup Influxdb on Linux

# InfluxDB OSS networking ports

By default, InfluxDB uses the following network ports:

  • TCP port 8086 is available for client-server communication using the InfluxDB API.
  • TCP port 8088 is available for the RPC service to perform back up and restore operations.

# Ubuntu & Debian

Debian and Ubuntu users can install the latest stable version of InfluxDB using the apt-get package manager.

For Ubuntu users, add the InfluxData repository with the following commands:

curl -s https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

For Debian users, add the InfluxData repository:

wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
echo "deb https://repos.influxdata.com/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

Then, install and start the InfluxDB service:

sudo apt-get update && sudo apt-get install influxdb
sudo systemctl unmask influxdb.service
sudo systemctl start influxdb

# Redhat and Centos

Red Hat and CentOS users can install the latest stable version of InfluxDB using the yum package manager:

cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF

Once repository is added to the yum configuration, install and start the InfluxDB service by running:

sudo yum install influxdb
sudo service influxdb start

Or if your operating system is using systemd (CentOS 7+, RHEL 7+):

sudo yum install influxdb
sudo systemctl start influxdb

Restart

sudo systemctl restart influxdb

sudo systemctl status influxdb

Troubleshooting

journalctl -fu influxdb

The first time running influxdb, the service couldn’t start, error log shows this:

Aug 03 13:28:26 frhb64566ds systemd[46045]: influxdb.service: Failed to execute command: Permission denied
Aug 03 13:28:26 frhb64566ds systemd[46045]: influxdb.service: Failed at step EXEC spawning /usr/lib/influxdb/scripts/influxd-systemd-start.sh: Permission denied
Aug 03 13:28:26 frhb64566ds systemd[1]: influxdb.service: Control process exited, code=exited, status=203/EXEC
Aug 03 13:28:26 frhb64566ds systemd[1]: influxdb.service: Failed with result &#039;exit-code&#039;.
Aug 03 13:28:26 frhb64566ds systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.
Aug 03 13:28:27 frhb64566ds systemd[1]: influxdb.service: Scheduled restart job, restart counter is at 5.
Aug 03 13:28:27 frhb64566ds systemd[1]: Stopped InfluxDB is an open-source, distributed, time series database.
Aug 03 13:28:27 frhb64566ds systemd[1]: influxdb.service: Start request repeated too quickly.
Aug 03 13:28:27 frhb64566ds systemd[1]: influxdb.service: Failed with result &#039;exit-code&#039;.
Aug 03 13:28:27 frhb64566ds systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.

Checking the status of the service with:

sudo systemctl status influxdb

I get this output:

root@frhb64566ds:~# sudo systemctl status influxdb
&#x25CF; influxdb.service - InfluxDB is an open-source, distributed, time series database
     Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2021-08-03 13:28:27 UTC; 56s ago
       Docs: https://docs.influxdata.com/influxdb/
    Process: 46045 ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh (code=exited, status=203/EXEC)

Aug 03 13:28:27 frhb64566ds systemd[1]: influxdb.service: Scheduled restart job, restart counter is at 5.
Aug 03 13:28:27 frhb64566ds systemd[1]: Stopped InfluxDB is an open-source, distributed, time series database.
Aug 03 13:28:27 frhb64566ds systemd[1]: influxdb.service: Start request repeated too quickly.
Aug 03 13:28:27 frhb64566ds systemd[1]: influxdb.service: Failed with result &#039;exit-code&#039;.
Aug 03 13:28:27 frhb64566ds systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.

Inspecting the file permissions with:

root@frhb64566ds:~# ls -l /usr/lib/influxdb/scripts/influxd-systemd-start.sh
-rwxr--r-- 1 root root 520 Jul 21 20:13 /usr/lib/influxdb/scripts/influxd-systemd-start.sh

From the output it looks like this file in exec start /usr/lib/influxdb/scripts/influxd-systemd-start.sh is owned by root.

To know the user running the service, edit the service file in systemd output above:

cat /lib/systemd/system/influxdb.service

Output:

# If you modify this, please also make sure to edit init.sh

[Unit]
Description=InfluxDB is an open-source, distributed, time series database
Documentation=https://docs.influxdata.com/influxdb/
After=network-online.target

[Service]
User=influxdb
Group=influxdb
LimitNOFILE=65536
EnvironmentFile=-/etc/default/influxdb
ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh
KillMode=control-group
Restart=on-failure
Type=forking
PIDFile=/var/lib/influxdb/influxd.pid

[Install]
WantedBy=multi-user.target
Alias=influxd.service

Since the service user and group is influxdb, we need to update permissions to that with this command:

sudo chown influxdb.influxdb /usr/lib/influxdb/scripts/influxd-systemd-start.sh

For this error

Aug 03 20:24:20 cloudsrv.citizix.com influxd-systemd-start.sh[544688]: run: open server: open tsdb store: mkdir /var/lib/influxdb/data/_internal/_series: permission denied

Ensure the influxdb data dir is owned by infludb user

chown -R influxdb.influxdb /var/lib/influxdb
comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy