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.
- 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
- 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
- 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.
- Access the InfluxDB command-line interface:
influx
- 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;
- Exit the InfluxDB CLI by typing:
exit
Step 7: Enable Authentication
For security reasons, it’s crucial to enable authentication in InfluxDB.
- Open the configuration file:
sudo nano /etc/influxdb/influxdb.conf
- Under the
[http]
section, locate and update the following line:
auth-enabled = true
- Save the file and restart InfluxDB:
sudo systemctl restart influxdb
- 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/
Pingback: ExpressJS - Web framework for Node.js - IoTbyHVM
Pingback: How To Install Django on Ubuntu - How To - IoTbyHVM
Pingback: Introduction of Socket.IO - A real-time web applications - IoTbyHVM
Pingback: SQLite - Suitable Database Engine for Embedded and IoT Devices
Pingback: InfluxDB | Installation | How To Use | Time Series Database ?
Pingback: InfluxDB | Time Series Database ? | TickStack | Tickscript ?