This brief tutorial shows students and new users how to install and configure InfluxDB on Ubuntu 18.04 | 16.04.
For the uninitiated, InfluxDB is an open-source, time series database written in Go that is optimized for fast, high availability of storage and retrieval of time series data sets such as monitoring, analytics, metrics, and others.
If you’re looking for an open-source time series database that is optimized for speed, then InfluxDB is a great place to start.
If you’re a student or a new user, you will find that the easiest place to start learning Linux is on Ubuntu Linux OS.
It’s a great Linux operating system for beginners.
Ubuntu is an open-source Linux operating system that runs on desktops, laptops, servers, and other devices.
To get started with installing InfluxDB, follow the steps below:
There are multiple ways to install InfluxDB on Ubuntu. However, installing it from its official repository is the easiest and fastest way.
To do that, run the commands below to add its repository key to Ubuntu
sudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
After adding the key, run the commands below to create a repository file
sudo echo "deb https://repos.influxdata.com/ubuntu bionic stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
When you’re done adding the repository key and file, run the commands below to update the Ubuntu packages index and install InfluxDB
sudo apt update sudo apt install influxdb
After installing, the commands below can stop, start and enable InfluxDB services to automatically start up when the server boots.
sudo systemctl stop influxdb sudo systemctl start influxdb sudo systemctl enable --now influxdb sudo systemctl is-enabled influxdb
To check and validate that InfluxDB is installed and running, run the status command below:
sudo systemctl status influxdb
That should display similar lines as shown below:
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 2020-04-14 21:42:56 CDT; 22s ago Docs: https://docs.influxdata.com/influxdb/ Main PID: 23788 (influxd) Tasks: 10 (limit: 4666) CGroup: /system.slice/influxdb.service └─23788 /usr/bin/influxd -config /etc/influxdb/influxdb.conf Apr 14 21:43:01 ubuntu1804 influxd: ts=2020-04-15T02:43:01.763007Z lvl=info msg="Starting precreation Apr 14 21:43:01 ubuntu1804 influxd: ts=2020-04-15T02:43:01.763013Z lvl=info msg="Starting snapshot ser
By default, the InfluxDB configuration file is under /etc/influxdb/influxdb.conf.
Many of its configurations are commented out and not used. Go and make changes to the configuration file that suits your environment. When you’re done, save the file and exit.
For example, to allow HTTP authentication, enable the line under [http] as shown in the file below:
sudo nano /etc/influxdb/influxdb.conf
Edit the line shown and save.
[http] # Determines whether HTTP endpoint is enabled. enabled = true # Determines whether the Flux query endpoint is enabled. # flux-enabled = false
Restart InfluxDB after making changes to its configuration file.
You can now create an admin account using the commands below:
curl -XPOST "http://localhost:8086/query" --data-urlencode "q=CREATE USER superadmin WITH PASSWORD 'type_password_here' WITH ALL PRIVILEGES"
Replace superadmin and type_password_here with username and password for the account.
Now that you’ve created an admin account, you can access the InfluxDB terminal console by running the commands below:
influx -username 'superadmin' -password 'your_password_here'
That should log on to the console.
Connected to http://localhost:8086 version 1.7.10 InfluxDB shell version: 1.7.10
By default, it communicates on port 8086.
You can use curl to run queries. For example, to list databases, run the curl commands below:
curl -G http://localhost:8086/query -u superadmin:password_here --data-urlencode "q=SHOW DATABASES"
That’s how to install InfluxDB on Ubuntu
This post showed you how to install InfluxDB on Ubuntu. If you find any error above, please use the comment form below to report.
You may also like the post below:
Thanks for the tutorial,
after your command ‘sudo apt install influxdb’
I had to add
‘sudo apt install influxdb-client’