{"id":1214,"date":"2024-04-11T02:35:19","date_gmt":"2024-04-10T23:35:19","guid":{"rendered":"https:\/\/www.fibacloud.com\/community\/tutorials\/?p=1214"},"modified":"2026-10-04T22:57:46","modified_gmt":"2026-10-04T19:57:46","slug":"installing-influxdb-on-ubuntu","status":"publish","type":"post","link":"https:\/\/www.fibacloud.com\/community\/tutorials\/en\/installing-influxdb-on-ubuntu\/","title":{"rendered":"Install InfluxDB 2.x on Ubuntu 24.04"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"1214\" class=\"elementor elementor-1214\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-538e370 e-con-full e-flex e-con e-parent\" data-id=\"538e370\" data-element_type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-2acf378 elementor-widget elementor-widget-text-editor\" data-id=\"2acf378\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.21.0 - 08-05-2024 *\/\n.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:#69727d;color:#fff}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap{color:#69727d;border:3px solid;background-color:transparent}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap{margin-top:8px}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter{width:1em;height:1em}.elementor-widget-text-editor .elementor-drop-cap{float:left;text-align:center;line-height:1;font-size:50px}.elementor-widget-text-editor .elementor-drop-cap-letter{display:inline-block}<\/style>\t\t\t\t<p>This guide installs <strong>a new InfluxDB OSS 2.x server on Ubuntu 24.04 LTS<\/strong> and writes\/queries a time-series measurement. InfluxDB 1.x, 2.x and 3 do not share one package, API or query model. Do not apply these steps over an existing 1.x\/3 installation or data directory. For InfluxDB 3, evaluate its <a href=\"https:\/\/docs.influxdata.com\/influxdb3\/core\/install\/\" rel=\"nofollow noopener\" target=\"_blank\">separate official installation procedure<\/a>.<\/p>\n<figure class=\"fc-editorial-figure\" data-fc-visual=\"20260920\" aria-labelledby=\"fc-editorial-caption-1214\"><a href=\"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-influx-en-inline-20260920.webp\" target=\"_blank\" rel=\"noopener\" aria-label=\"Open full-size illustration\"><picture><source media=\"(max-width: 600px)\" srcset=\"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-influx-en-mobile-20260920.webp\" width=\"720\" height=\"1140\"><img loading=\"lazy\" src=\"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-influx-en-inline-20260920.webp\" srcset=\"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-influx-en-inline-20260920.webp 1440w, https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-influx-en-inline-20260920-300x242.webp 300w, https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-influx-en-inline-20260920-1024x825.webp 1024w, https:\/\/www.fibacloud.com\/community\/tutorials\/wp-content\/uploads\/community-editorial-20260920\/fc-influx-en-inline-20260920-768x619.webp 768w\" sizes=\"auto, (max-width: 900px) 100vw, 820px\" width=\"1440\" height=\"1160\" alt=\"The journey of time-series data\" class=\"wp-image-2506\"  decoding=\"async\"><\/picture><\/a><figcaption id=\"fc-editorial-caption-1214\"><strong>The journey of time-series data<\/strong> Timestamped measurements are collected, written to the database and queried over time windows. Retention defines their lifecycle.<details><summary>Step-by-step explanation<\/summary><ol><li>Measure: Timestamp every sample.<\/li><li>Write: Use the API for your chosen version.<\/li><li>Query: Compare measurements over a time window.<\/li><li>Retain: Set a retention policy for your needs.<\/li><\/ol><\/details><\/figcaption><\/figure>\n<h2>Prerequisites and access model<\/h2>\n<p>You need a sudo user, server-console access and an SSH client. Initial setup will listen only on loopback; do not expose port 8086 publicly. If InfluxDB or its data already exists, identify its version and backup\/migration plan first.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-91037aa elementor-widget elementor-widget-text-editor\" data-id=\"91037aa\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-bash\">cat \/etc\/os-release\ndpkg-query -W 'influx*' 2&gt;\/dev\/null\nss -lnt | awk '$4 ~ \/:8086$\/ {print}'\nsudo apt-get update\nsudo apt-get install ca-certificates curl gnupg<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fd831ad elementor-widget elementor-widget-text-editor\" data-id=\"fd831ad\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h2>Add the signed APT repository<\/h2>\n<p>The <a href=\"https:\/\/docs.influxdata.com\/influxdb\/v2\/install\/\" rel=\"nofollow noopener\" target=\"_blank\">official 2.x installation guide<\/a> documents the archive key and a <code>signed-by<\/code> repository for Ubuntu 24.04. Compare the fingerprint below with that document. If the vendor rotates its key, review the new official fingerprint instead of bypassing verification.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fd50378 elementor-widget elementor-widget-text-editor\" data-id=\"fd50378\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-bash\">key_dir=$(mktemp -d)\ncurl --fail --show-error --location \\\n  https:\/\/repos.influxdata.com\/influxdata-archive.key \\\n  -o \"$key_dir\/influxdata-archive.key\"\ngpg --show-keys --with-colons \"$key_dir\/influxdata-archive.key\"<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-87275cb elementor-widget elementor-widget-text-editor\" data-id=\"87275cb\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The first primary-key <code>fpr<\/code> value must be <code>24C975CBA61A024EE1B631787C3D57159FC2F927<\/code>. Stop on a mismatch. After verifying it:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-48ae95c elementor-widget elementor-widget-text-editor\" data-id=\"48ae95c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-bash\">sudo install -d -m 755 \/etc\/apt\/keyrings\ngpg --dearmor --output \"$key_dir\/influxdata-archive.gpg\" \\\n  \"$key_dir\/influxdata-archive.key\"\nsudo install -m 644 \"$key_dir\/influxdata-archive.gpg\" \\\n  \/etc\/apt\/keyrings\/influxdata-archive.gpg\nprintf '%s\\n' 'deb [signed-by=\/etc\/apt\/keyrings\/influxdata-archive.gpg] https:\/\/repos.influxdata.com\/debian stable main' \\\n  | sudo tee \/etc\/apt\/sources.list.d\/influxdata.list\nsudo apt-get update\napt-cache policy influxdb2 influxdb2-cli<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fc8e62b elementor-widget elementor-widget-text-editor\" data-id=\"fc8e62b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Verify that candidates come from the expected InfluxData source and that the server package belongs to 2.x. Do not use <code>apt-key<\/code> or APT options that disable signature validation.<\/p>\n<h2>Restrict the first startup to loopback<\/h2>\n<p>The mask below prevents package installation from starting an unconfigured service on a <strong>new installation<\/strong>. Do not apply it to an existing production service.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5a7ef66 elementor-widget elementor-widget-text-editor\" data-id=\"5a7ef66\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-bash\">sudo systemctl mask influxdb.service\nsudo apt-get install influxdb2 influxdb2-cli\nsudo install -d -m 755 \/etc\/systemd\/system\/influxdb.service.d\nprintf '%s\\n' '[Service]' 'Environment=INFLUXD_HTTP_BIND_ADDRESS=127.0.0.1:8086' \\\n  | sudo tee \/etc\/systemd\/system\/influxdb.service.d\/listen-local.conf\nsudo systemctl daemon-reload\nsudo systemctl unmask influxdb.service\nsudo systemctl enable --now influxdb.service\nsudo systemctl status influxdb.service --no-pager\ninfluxd version\ninflux version\nss -lnt | awk '$4 ~ \/:8086$\/ {print}'\ncurl --fail --show-error http:\/\/127.0.0.1:8086\/health<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2975020 elementor-widget elementor-widget-text-editor\" data-id=\"2975020\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The listener must be <code>127.0.0.1:8086<\/code>. If you see <code>0.0.0.0<\/code> or <code>[::]<\/code>, fix the configuration before allowing public access. The server and CLI are versioned separately; their version numbers need not match.<\/p>\n<h2>Create the organization, bucket and initial account<\/h2>\n<p>On the server, run <code>umask 077<\/code>, then <code>influx setup<\/code>. At the interactive prompts, choose a strong administrator password, organization <code>fibacloud-lab<\/code>, bucket <code>metrics_lab<\/code> and a retention period such as <code>168h<\/code>. That is one week for this lab; determine actual retention from your requirements. Do not repeat setup on an initialized instance.<\/p>\n<p>The CLI&#8217;s local configuration may contain a privileged token. Verify that <code>~\/.influxdbv2\/configs<\/code> is readable only by your account. Do not give the administrator\/operator token to an application or Grafana.<\/p>\n<p>For the web UI, open a tunnel <strong>from your own computer<\/strong>. Replace the example host\/user with the verified identity of your server:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-56671d9 elementor-widget elementor-widget-text-editor\" data-id=\"56671d9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-bash\">ssh -N -L 18086:127.0.0.1:8086 kullanici@sunucu.example.com<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f9f5c3c elementor-widget elementor-widget-text-editor\" data-id=\"f9f5c3c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Open <code>http:\/\/127.0.0.1:18086<\/code> in your browser. This local HTTP endpoint is inside the encrypted SSH tunnel; never send tokens over HTTP directly to the server&#8217;s public IP. Shared or permanent access needs HTTPS and restricted networking.<\/p>\n<h2>Write and query using a restricted token<\/h2>\n<p>In API Tokens, create a custom token with read\/write access only to <code>metrics_lab<\/code>. For separate production writers\/readers, split those permissions into different tokens. Read the token interactively instead of adding it to shell history:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2de9fb7 elementor-widget elementor-widget-text-editor\" data-id=\"2de9fb7\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<pre><code class=\"language-bash\">read -rsp 'Token: ' INFLUX_TOKEN\nprintf '\\n'\nexport INFLUX_TOKEN\nexport INFLUX_HOST=http:\/\/127.0.0.1:8086\ninflux write --org fibacloud-lab --bucket metrics_lab \\\n  'cpu,host=demo usage_user=12.5'\ninflux query --org fibacloud-lab \\\n  'from(bucket:\"metrics_lab\") |&gt; range(start:-15m) |&gt; filter(fn:(r) =&gt; r._measurement == \"cpu\")'\nunset INFLUX_TOKEN<\/code><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f9d9873 elementor-widget elementor-widget-text-editor\" data-id=\"f9d9873\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The result should include <code>host=demo<\/code>, <code>usage_user<\/code> and <code>12.5<\/code>. Without an explicit timestamp, the server uses write time; your query range must include it. Verify that the token cannot access other buckets or administrative operations. Distinguish a 401\/403 for an invalid token from a wrong bucket name or an empty time range.<\/p>\n<h2>Backup, troubleshooting and recovery<\/h2>\n<p>Follow the <a href=\"https:\/\/docs.influxdata.com\/influxdb\/v2\/admin\/backup-restore\/\" rel=\"nofollow noopener\" target=\"_blank\">2.x backup\/restore procedure<\/a> with an appropriately privileged account. Restore into a separate instance and verify measurements and token permissions. Do not treat an ordinary copy of a running data directory as a reliable backup.<\/p>\n<p>For startup problems, inspect <code>sudo journalctl -u influxdb -n 80 --no-pager<\/code>, the version and the drop-in. Correct the port\/service setting instead of removing the local-access boundary. Stop a failed new installation and retain its data\/logs; do not delete an existing data directory. A 2.x-to-3 migration or downgrade is a separate data-migration project.<\/p>\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/docs.influxdata.com\/influxdb\/v2\/install\/\" rel=\"nofollow noopener\" target=\"_blank\">InfluxDB 2.x: signatures, packages and services<\/a><\/li>\n<li><a href=\"https:\/\/docs.influxdata.com\/influxdb\/v2\/get-started\/setup\/\" rel=\"nofollow noopener\" target=\"_blank\">InfluxDB 2.x: initial setup<\/a><\/li>\n<li><a href=\"https:\/\/docs.influxdata.com\/influxdb\/v2\/admin\/tokens\/create-token\/\" rel=\"nofollow noopener\" target=\"_blank\">InfluxDB 2.x: custom API tokens<\/a><\/li>\n<li><a href=\"https:\/\/docs.influxdata.com\/influxdb\/v2\/write-data\/developer-tools\/api\/\" rel=\"nofollow noopener\" target=\"_blank\">InfluxDB 2.x: writing through the API<\/a><\/li>\n<li><a href=\"https:\/\/docs.influxdata.com\/influxdb\/v2\/query-data\/execute-queries\/influx-api\/\" rel=\"nofollow noopener\" target=\"_blank\">InfluxDB 2.x: executing queries<\/a><\/li>\n<li><a href=\"https:\/\/docs.influxdata.com\/influxdb\/v2\/admin\/backup-restore\/\" rel=\"nofollow noopener\" target=\"_blank\">InfluxDB 2.x: backup and restore<\/a><\/li>\n<\/ul>\n<p class=\"fc-article-review-date\">Technical content and sources reviewed on October 4, 2026. Recheck the relevant official documentation when a version or provider changes.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Install InfluxDB 2.x on Ubuntu 24.04 with a signed repository, local access, scoped API tokens, write\/query checks and backup guidance.<\/p>\n","protected":false},"author":1,"featured_media":2505,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[80,94,96,98,100],"class_list":["post-1214","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials-en","tag-databases","tag-influxdb","tag-linux","tag-monitoring","tag-ubuntu"],"lang":"en","translations":{"en":1214,"tr":1170},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/posts\/1214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/comments?post=1214"}],"version-history":[{"count":14,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/posts\/1214\/revisions"}],"predecessor-version":[{"id":1367,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/posts\/1214\/revisions\/1367"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/media\/2505"}],"wp:attachment":[{"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/media?parent=1214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/categories?post=1214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fibacloud.com\/community\/tutorials\/wp-json\/wp\/v2\/tags?post=1214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}