How to Install InfluxDB on Ubuntu
Data AnalyticsHow ToLinuxTutorials/DIY

How to Install InfluxDB on Ubuntu

InfluxDB is a powerful open-source time-series database designed for high-performance querying, visualization, and alerting. This guide will walk you through installing and configuring InfluxDB on Ubuntu.

Step 1: Update System Packages

Before proceeding, ensure your system packages are up to date. Run the following commands:

sudo apt update
sudo apt upgrade -y

Step 2: Import InfluxDB Repository

InfluxDB is not included in Ubuntu’s default repository. To install it, you need to add the official InfluxData repository.

  1. Download the InfluxDB GPG key:
wget -qO- https://repos.influxdata.com/influxdata-archive_compat.key | sudo gpg --dearmor -o /usr/share/keyrings/influxdb-keyring.gpg
  1. Add the InfluxDB repository:
echo "deb [signed-by=/usr/share/keyrings/influxdb-keyring.gpg] https://repos.influxdata.com/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
  1. Update the package list:
sudo apt update

Step 3: Install InfluxDB

To install InfluxDB, run the following command:

sudo apt install influxdb -y

Once the installation is complete, proceed to enable and start the InfluxDB service.

Step 4: Start and Enable InfluxDB Service

To ensure InfluxDB runs at startup and starts immediately, use the following commands:

sudo systemctl enable influxdb
sudo systemctl start influxdb

Verify its status to confirm it’s running correctly:

sudo systemctl status influxdb

If the service is active and running, you are ready for the next step.

Step 5: Configure InfluxDB

By default, InfluxDB uses the following configurations:

  • Port 8086 for HTTP API
  • Port 8088 for backup/restore operations

To modify the configuration, open the InfluxDB configuration file:

sudo nano /etc/influxdb/influxdb.conf

Key configuration options include:

  • [http]: For enabling/disabling HTTP API.
  • [data]: For defining data storage settings.
  • [meta]: For configuring metadata nodes.

After making changes, restart the service:

sudo systemctl restart influxdb

Step 6: Create an InfluxDB User and Database

To begin using InfluxDB, you must create a user and database.

  1. Access the InfluxDB command-line interface:
influx
  1. Run the following commands to create a database and a user:
CREATE DATABASE my_database;
CREATE USER "admin" WITH PASSWORD 'secure_password' WITH ALL PRIVILEGES;
  1. Exit the InfluxDB CLI by typing:
exit

Step 7: Enable Authentication

For security reasons, it’s crucial to enable authentication in InfluxDB.

  1. Open the configuration file:
sudo nano /etc/influxdb/influxdb.conf
  1. Under the [http] section, locate and update the following line:
auth-enabled = true
  1. Save the file and restart InfluxDB:
sudo systemctl restart influxdb
  1. To connect securely using the newly created admin user:
influx -username admin -password secure_password

Step 8: Verifying InfluxDB Installation

You can verify the installation by sending a simple query:

influx -execute 'SHOW DATABASES'

You should see your newly created database listed.

Step 9: Enable Firewall Rules (Optional)

To secure your InfluxDB server, configure your firewall to allow inbound traffic on port 8086 (HTTP API):

sudo ufw allow 8086/tcp
sudo ufw reload

Step 10: Accessing InfluxDB Web UI (Optional)

For improved usability, you can enable the InfluxDB UI by visiting:

http://<your-server-ip>:8086

From here, you can visualize data, manage databases, and configure your InfluxDB instance.

Conclusion

You have successfully installed and configured InfluxDB on Ubuntu. You can now begin storing, querying, and visualizing time-series data efficiently. If you encounter any issues, refer to the official InfluxDB documentation for additional guidance.

Read This: https://iotbyhvm.ooo/what-is-a-time-series-database/

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

6 thoughts on “How to Install InfluxDB on Ubuntu

Leave a Reply

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