How To Install InfluxDB on Amazon Linux 2

Posted on 221 views

InfluxDB is a popular open source time series database with APIs for querying and storing data and processing the data in the background for visualization, monitoring and alerting purposes and user dashboards. InfluxDB is designed to handle high write and query loads and provides a SQL-like query language called InfluxQL for interacting with data. The time series database is part of the TICK (Telegraf, InfluxDB, Chronograf, Kapacitor) stack.

In this article we will be performing an installation of InfluxDB on Amazon Linux 2. The server can be running in the Cloud or as a VM in your home or company’s Infrastructure. The edition of InfluxDB that we’ll be installing is the open source (OSS). With this installation you’ll get the influx command line interface (CLI), which is included in all InfluxDB packages and is a lightweight and simple way to interact with the database.

Install InfluxDB on Amazon Linux 2

As of this article update the latest release of InfluxDB time series database is version 2.0 but is available in Beta and not fit for production use. As we can cannot dictate the use, we’ll be doing the installation of InfluxDB 1.x on Amazon Linux 2 server.

The first step is addition of YUM repository. This is done by executing the commands below in the terminal.

cat <

Run the yum repolist command to confirm we’ve the repository added to our Amazon Linux 2 server.

$ sudo yum repolist
Loaded plugins: dkms-build-requires, langpacks, priorities, update-motd
amzn2-core                                                                                                                                 | 3.7 kB  00:00:00
amzn2extra-docker                                                                                                                          | 3.0 kB  00:00:00
grafana/signature                                                                                                                          |  488 B  00:00:00
grafana/signature                                                                                                                          | 2.9 kB  00:00:00 !!!
influxdb                                                                                                                                   | 2.5 kB  00:00:00
prometheus/signature                                                                                                                       |  833 B  00:00:00
prometheus/signature                                                                                                                       | 1.0 kB  00:00:00 !!!
(1/4): amzn2extra-docker/2/x86_64/updateinfo                                                                                               |   76 B  00:00:00
(2/4): amzn2extra-docker/2/x86_64/primary_db                                                                                               |  68 kB  00:00:00
(3/4): influxdb/primary_db                                                                                                                 |  49 kB  00:00:00
(4/4): grafana/primary_db                                                                                                                  |  78 kB  00:00:01
repo id                                                                    repo name                                                                       status
amzn2-core/2/x86_64                                                        Amazon Linux 2 core repository                                                   21,106
amzn2extra-docker/2/x86_64                                                 Amazon Extras repo for docker                                                        28
grafana                                                                    grafana                                                                         115+152
influxdb                                                                   InfluxDB Repository - RHEL 7                                                        204
prometheus                                                                 prometheus                                                                          336
repolist: 21,789

If all is good proceed with the installation of InfluxDB on Amazon Linux 2 server.

sudo yum install influxdb

All that is required to complete the installation is hitting a key.

Dependencies Resolved

 Package                                Arch                                 Version                                 Repository                              Size
 influxdb                               x86_64                               1.8.3-1                                 influxdb                                61 M

Transaction Summary
Install  1 Package

Total download size: 61 M
Installed size: 166 M
Is this ok [y/d/N]: y

Do the same for GPG key importation.

Retrieving key from
Importing GPG key 0x2582E0C5:
 Userid     : "InfluxDB Packaging Service "
 Fingerprint: 05ce 1508 5fc0 9d18 e99e fb22 684a 14cf 2582 e0c5
 From       :
Is this ok [y/N]: y

Then make sure the service is started:

sudo systemctl start influxdb

Set the service to be started every time the server is restarted.

sudo systemctl enable influxdb

Check service status.

$ systemctl status influxd
● influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/usr/lib/systemd/system/influxdb.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-10-07 18:09:59 UTC; 11s ago
 Main PID: 3570 (influxd)
   CGroup: /system.slice/influxdb.service
           └─3570 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

Oct 07 18:09:59 amazon-linux influxd[3570]: ts=2020-10-07T18:09:59.527670Z lvl=info msg="Starting precreation service" log_id=0Pi3wMVl000 service=shar...eriod=30m
Oct 07 18:09:59 amazon-linux influxd[3570]: ts=2020-10-07T18:09:59.527682Z lvl=info msg="Starting snapshot service" log_id=0Pi3wMVl000 service=snapshot
Oct 07 18:09:59 amazon-linux influxd[3570]: ts=2020-10-07T18:09:59.527686Z lvl=info msg="Starting continuous query service" log_id=0Pi3wMVl000 service...s_querier
Oct 07 18:09:59 amazon-linux influxd[3570]: ts=2020-10-07T18:09:59.527695Z lvl=info msg="Starting HTTP service" log_id=0Pi3wMVl000 service=httpd authe...ion=false
Oct 07 18:09:59 amazon-linux influxd[3570]: ts=2020-10-07T18:09:59.527699Z lvl=info msg="opened HTTP access log" log_id=0Pi3wMVl000 service=httpd path=stderr
Oct 07 18:09:59 amazon-linux influxd[3570]: ts=2020-10-07T18:09:59.527758Z lvl=info msg="Listening on HTTP" log_id=0Pi3wMVl000 service=httpd addr=[::]...tps=false
Oct 07 18:09:59 amazon-linux influxd[3570]: ts=2020-10-07T18:09:59.527768Z lvl=info msg="Starting retention policy enforcement service" log_id=0Pi3wMV...erval=30m
Oct 07 18:09:59 amazon-linux influxd[3570]: ts=2020-10-07T18:09:59.530852Z lvl=info msg="Listening for signals" log_id=0Pi3wMVl000
Oct 07 18:09:59 amazon-linux influxd[3570]: ts=2020-10-07T18:09:59.531129Z lvl=info msg="Storing statistics" log_id=0Pi3wMVl000 service=monitor db_ins...erval=10s
Oct 07 18:09:59 amazon-linux influxd[3570]: ts=2020-10-07T18:09:59.531484Z lvl=info msg="Sending usage statistics to" log_id=0Pi3wMVl000
Hint: Some lines were ellipsized, use -l to show in full.

The network ports used by InfluxDB are:

  • TCP port 8086 is used for client-server communication over InfluxDB’s HTTP API
  • TCP port 8088 is used for the RPC service for backup and restore.

If you have an active firewalld service add these ports to the allowed list.

sudo firewall-cmd --add-port=8086/tcp --permanent
sudo firewall-cmd --add-port=8088/tcp --permanent
sudo firewall-cmd --reload

Let’s test InfluxDB by sending curl request to show databases.

curl -G http://localhost:8086/query --data-urlencode "q=SHOW DATABASES"



Enable Authentication (optional)

The InfluxDB API and the command line interface (CLI), which connects to the database using the API, include simple, built-in authentication based on user credentials.

To enable authentication edit InfluxDB configuration file and turn auth-enabled to true.

sudo vim /etc/influxdb/influxdb.conf

Look for the [http] section in the configuration file – Around line 245

  enabled = true
  bind-address = ":8086"
  auth-enabled = true # Set to true
  log-enabled = true 

When you enable HTTP authentication, InfluxDB requires you to create at least one admin user before you can interact with the system.

$ influx
Connected to http://localhost:8086 version 1.8.3
InfluxDB shell version: 1.8.3

Create Admin user.


To create an additional admin user the same syntax is used.




To grant Admin privileges to existing user run:


When done exit the InfluxDB shell.

> exit

Restart influxdb service.

sudo systemctl restart influxdb

This is how you’ll use the influx command line tool to connect to InfluxDB with authentication.

$ influx -username admin -password '[email protected]'

Connected to http://localhost:8086 version 1.8.3
InfluxDB shell version: 1.8.3
name: databases

For curl use:

$ curl -G "http://localhost:8086/[email protected]" --data-urlencode "q=SHOW DATABASES"



curl -G http://localhost:8086/query -u admin:[email protected] --data-urlencode "q=SHOW DATABASES"

If you try without providing the username and password you should get authentication error message.

curl -G http://localhost:8086/query --data-urlencode "q=SHOW DATABASES"
"error":"unable to parse authentication credentials"

Enjoy using InfluxDB to store time series data and build and end-to-end monitoring platform for both Applications and Infrastructure.


Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.