Kibana: Installation & Configuration

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Checked on 2026-11-09 against Kibana 9.5.x. Tested with Elasticsearch 9.5.6 and Kibana 9.5.6 in the hands-on lab (trial licence): the Compose services below start Elasticsearch, the one-shot password service and Kibana, and Kibana reports available.

To do this by hand, follow First Steps in Kibana.

A Kibana container with default settings starts in seconds, and that is what makes it dangerous: with no explicit encryption key the alerting features stay blocked, with no server.publicBaseUrl the links in notifications point nowhere, and a password put in an environment variable is visible to anyone who can list processes. This page shows how to run Kibana deliberately: three ways to start it (a throwaway one, the documented Docker flow, and the Compose file used by the lab), where settings come from and in which order they win, how Kibana authenticates to Elasticsearch, and which secrets must be set before alerting works. How the pieces fit is on Architecture & the Elastic Stack; general Docker practice is in Docker resources, logging and monitoring, and Elasticsearch installation and cluster settings are in the Elasticsearch section. Kibana on Elastic Cloud Serverless is not installed at all, and on Elastic Cloud Hosted its settings are changed through the deployment, so everything below applies to self-managed installations.

What the server needs

Kibana runs on Linux, macOS (Darwin) and Windows. It ships with the Node.js binaries it needs, and running it with a separately maintained Node.js is not supported. It is distributed as tar.gz (Linux and macOS), zip (Windows), deb, rpm and as a Docker image from the Elastic registry; the page says deb, rpm and Docker are the most straightforward if you have no preference. The version rule is strict: use the same version for every Stack component (Elasticsearch 9.5.6 with Kibana 9.5.6), never mix major versions, and never run a Kibana minor version newer than the Elasticsearch minor version. The default ports are 5601 for Kibana (server.port) and 9200 for the Elasticsearch REST API.

Source: Install Kibana.

start-local: the fastest throwaway stack

For development, Elastic provides a script that starts Elasticsearch and Kibana in Docker with one command:

curl -fsSL https://elastic.co/start-local | sh

It needs Docker Compose (version 2 or later is recommended, 1.29.0 is the minimum) and, on Windows, WSL. When it finishes, Elasticsearch answers on http://localhost:9200 and Kibana on http://localhost:5601. According to the project’s README it creates the folder elastic-start-local (changeable with ES_LOCAL_DIR), writes the credentials to its .env file (ES_LOCAL_PASSWORD for the elastic user, KIBANA_LOCAL_PASSWORD and ES_LOCAL_API_KEY), and provides start.sh, stop.sh and uninstall.sh (the last one removes the installation and permanently erases all data). The -v flag selects a release and --esonly installs Elasticsearch without Kibana; a Podman variant exists. The installation comes with a one-month trial licence that includes all features, after which it reverts to Basic. The official page says plainly that this setup is for local development only, is not secure, and must not be used in production. Use it to look at Kibana in five minutes; use the lab’s Compose file when you want a reproducible environment with Bookshelf.

Docker, the documented flow

The official Docker guide for development starts a single-node Elasticsearch, then Kibana, on a shared network:

docker network create elastic
docker pull docker.elastic.co/elasticsearch/elasticsearch:9.5.6
docker run --name es01 --net elastic -p 9200:9200 -it -m 1GB docker.elastic.co/elasticsearch/elasticsearch:9.5.6

docker pull docker.elastic.co/kibana/kibana:9.5.6
docker run --name kib01 --net elastic -p 5601:5601 docker.elastic.co/kibana/kibana:9.5.6

Source: Install Kibana with Docker (section "Run Kibana in Docker for development", anchor #run-kibana-in-docker-for-development).

How it works:

  • The -m 1GB flag caps the container memory, so the JVM heap does not have to be set by hand. Docker Desktop should have at least 4 GB allocated.

  • The first start of Elasticsearch prints the password of the elastic user and an enrollment token for Kibana, once. If you missed them, regenerate with elasticsearch-create-enrollment-token -s kibana and elasticsearch-reset-password -u elastic, both run inside the container with docker exec.

  • Kibana prints a link at startup. Open it, paste the enrollment token and log in as elastic. The enrollment token handles the connection to Elasticsearch, so no host is configured manually in this flow.

  • A hardened variant of the image exists: docker.elastic.co/kibana/kibana-wolfi:9.5.6.

Everything in this flow is interactive and keeps its state inside containers, which makes it unsuitable for a lab that must come up unattended, so the lab uses the Compose file below.

The lab’s Compose file

The kibana profile of the lab needs Elasticsearch and Kibana to start without clicking through an enrollment screen. The file below does that for a single-node lab: Elasticsearch with security on but TLS off on the HTTP port, a one-shot service that sets the password of the built-in kibana_system user, and Kibana with the three encryption keys. Keep this file in the lab only; each deviation from production is listed after it.

services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:9.5.6
    profiles: ["kibana"]
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=true
      - xpack.security.http.ssl.enabled=false
      - xpack.license.self_generated.type=trial
      - ELASTIC_PASSWORD=${ELASTIC_PASSWORD:-lab-elastic-password}
    mem_limit: 2g
    ports:
      - "9200:9200"
    volumes:
      - esdata:/usr/share/elasticsearch/data
    healthcheck:
      test: ["CMD-SHELL", "curl -fsS -u elastic:$${ELASTIC_PASSWORD} 'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=5s' >/dev/null"]
      interval: 10s
      timeout: 10s
      retries: 30

  kibana-setup:
    image: docker.elastic.co/elasticsearch/elasticsearch:9.5.6
    profiles: ["kibana"]
    restart: "no"
    depends_on:
      elasticsearch:
        condition: service_healthy
    environment:
      ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-lab-elastic-password}
      KIBANA_PASSWORD: ${KIBANA_PASSWORD:-lab-kibana-password}
    entrypoint: ["/bin/sh", "-c"]
    command:
      - >
        curl -fsS -X POST -u "elastic:$${ELASTIC_PASSWORD}"
        -H "Content-Type: application/json"
        http://elasticsearch:9200/_security/user/kibana_system/_password
        -d "{\"password\":\"$${KIBANA_PASSWORD}\"}"

  kibana:
    image: docker.elastic.co/kibana/kibana:9.5.6
    profiles: ["kibana"]
    depends_on:
      kibana-setup:
        condition: service_completed_successfully
    environment:
      ELASTICSEARCH_HOSTS: '["http://elasticsearch:9200"]'
      ELASTICSEARCH_USERNAME: kibana_system
      ELASTICSEARCH_PASSWORD: ${KIBANA_PASSWORD:-lab-kibana-password}
      SERVER_PUBLICBASEURL: http://localhost:5601
      XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: ${KIBANA_SAVED_OBJECTS_KEY:-bookshelf-lab-saved-objects-key-0000}
      XPACK_SECURITY_ENCRYPTIONKEY: ${KIBANA_SECURITY_KEY:-bookshelf-lab-security-key-00000000}
      XPACK_REPORTING_ENCRYPTIONKEY: ${KIBANA_REPORTING_KEY:-bookshelf-lab-reporting-key-000000}
    ports:
      - "5601:5601"

volumes:
  esdata: {}

Reference: Install Kibana with Docker (image tags, environment variables, Docker defaults), Set up minimal security (the kibana_system user) and Change passwords API. The three encryption settings are from Security settings and Alerting settings.

What this file does and what you must change for anything real:

  • Security is on, TLS is off. Elasticsearch 9 enables security by default; the file leaves it on and only disables TLS on port 9200 so that Kibana and curl can use plain http. In production keep TLS on and give Kibana the CA (next section).

  • The command is a one-element list. Compose splits a command written as a plain string into separate arguments, so sh -c would run only the first word; written as command: > the service fails with curl’s usage message and exit code 2. The folded text is therefore a single list item.

  • The password of kibana_system is set by the one-shot service through the change-password API. The official page documents the equivalent command elasticsearch-reset-password -u kibana_system. kibana_system is the built-in user Kibana uses for background work; it is not meant for people and cannot log in to the UI.

  • Passwords and keys in environment variables. The Docker guide notes that environment variables override kibana.yml and are visible with ps, so they should not hold secrets. The lab accepts that; use the keystore or a mounted file elsewhere.

  • xpack.license.self_generated.type=trial starts a one-month trial licence, as start-local does, so every feature is available while learning. Each page of this subsection says when a feature needs a paid subscription, so you can tell which ones the trial is showing.

  • Memory. mem_limit: 2g is a lab choice in the spirit of the official -m 1GB run; size Elasticsearch for your data in production.

  • Environment variable names. The image maps names written in capitals with underscores onto dotted settings (SERVER_NAME to server.name, ELASTICSEARCH_HOSTS to elasticsearch.hosts), and list values are JSON arrays.

  • Image defaults. server.host is 0.0.0.0 in the image (the setting’s own default outside Docker is localhost), elasticsearch.hosts is http://elasticsearch:9200, and server.shutdownTimeout is 5s. A custom kibana.yml mounted over the image’s replaces these defaults, so copy them in if you still want them.

  • Encryption keys are explained in the last section; the default values shown are placeholders at least 32 characters long and must be replaced outside the lab.

Where settings come from

Kibana reads kibana.yml, which lives in $KIBANA_HOME/config for archive installs and in /etc/kibana for deb and rpm packages. Set the KBN_PATH_CONF environment variable to use another directory (for example KBN_PATH_CONF=/home/kibana/config ./bin/kibana). By default Kibana listens on localhost:5601; to accept remote connections set server.host (for example 0.0.0.0) and, if needed, server.port. In the container the settings can come from a bind-mounted file or from environment variables, and environment variables win over the file.

There are three layers, in this order of increasing secrecy:

  1. kibana.yml: plain text, suitable for non-secret settings.

  2. Environment variables, either mapped by the Docker image or substituted inside kibana.yml with ${MY_ENV_VAR}. By default Kibana fails validation at startup if a referenced variable is missing; a fallback is written ${MY_ENV_VAR:defaultValue}.

  3. The keystore, bin/kibana-keystore, for secrets.

A kibana.yml that uses substitution looks like this:

server.host: "0.0.0.0"
server.publicBaseUrl: "${KIBANA_PUBLIC_URL:http://localhost:5601}"
elasticsearch.hosts: ["${ES_URL:http://elasticsearch:9200}"]

Reference: Configure Kibana (sections "kibana.yml location" and "Environment variable substitution").

The keystore keeps secrets out of the file and out of ps. Run its commands as the user that runs Kibana:

bin/kibana-keystore create
bin/kibana-keystore add elasticsearch.serviceAccountToken
bin/kibana-keystore add xpack.encryptedSavedObjects.encryptionKey
bin/kibana-keystore list

create writes kibana.keystore in the directory given by KBN_PATH_CONF (add --password to protect it), add prompts for the value (or reads it with --stdin; input is parsed as JSON, so wrap a value that must stay a string in double quotes), and show, remove, passwd and has-passwd exist too. Unlike the Elasticsearch keystore, Kibana’s accepts any valid Kibana setting, and an invalid or unsupported setting stops Kibana from starting, so check the reference before adding one. In Docker, by default Kibana generates a keystore at startup and secure settings are lost when the container is recreated; to persist them, bind-mount the host config and data directories on /usr/share/kibana/config and /usr/share/kibana/data and run kibana-keystore as a one-off docker run -it --rm with the same mounts.

Source: Secure settings and Install Kibana with Docker (section "Persist the Kibana keystore", anchor #persist-the-kibana-keystore).

Connecting to Elasticsearch

The connection settings, with their documented defaults:

Setting Default Meaning

elasticsearch.hosts

[ "http://localhost:9200" ]

Elasticsearch nodes Kibana talks to; all must belong to the same cluster. Use https for TLS.

elasticsearch.serviceAccountToken

none

Authenticates as the elastic/kibana service account; an alternative to elasticsearch.username and elasticsearch.password.

elasticsearch.username

none

User for maintaining the Kibana index at startup (kibana_system in the lab).

elasticsearch.ssl.certificateAuthorities

none

Paths to PEM-encoded CA certificates that sign the Elasticsearch certificate.

elasticsearch.ssl.verificationMode

full

full, certificate or none. Keep full.

elasticsearch.requestTimeout

30000

Milliseconds to wait for Elasticsearch responses.

server.publicBaseUrl

none

The URL users reach Kibana at, with protocol, host and port if non-default, any server.basePath, and no trailing slash.

Source: General settings (anchors #server-publicbaseurl, #elasticsearch-requesttimeout and #elasticsearch-ssl-certificateauthorities).

For anything beyond a lab, authenticate with a service account token instead of a password. elastic/kibana is the service account that Kibana uses to communicate with Elasticsearch; you must create a token for it, and tokens never expire, so delete the ones you no longer use. The recommended method is the create-token REST API, which stores the token in the .security index so that it works on all nodes and is included in snapshots; the elasticsearch-service-tokens CLI instead writes a file on one node and is meant for orchestrators:

curl -s -u elastic:"$ELASTIC_PASSWORD" -X POST \
  "http://localhost:9200/_security/service/elastic/kibana/credential/token/kibana-prod"

The response contains the bearer value once; put it in the keystore as elasticsearch.serviceAccountToken, and set in kibana.yml:

elasticsearch.hosts: ["https://elasticsearch.internal:9200"]
elasticsearch.ssl.certificateAuthorities: ["/usr/share/kibana/config/certs/ca.crt"]
elasticsearch.ssl.verificationMode: full
server.publicBaseUrl: "https://kibana.example.com"

You can verify a token by sending it as Authorization: Bearer to /_security/_authenticate; the response names the user elastic/kibana. Service accounts do not support basic authentication.

Reference: Service accounts (section "Creating an elastic/kibana service token"; the exact request URL above is the create service account token API at Elasticsearch API reference).

Encryption keys: why alerting needs them

Kibana encrypts sensitive properties of saved objects (the secrets of connectors, the API keys that rules use to run) before it stores them in Elasticsearch. The key is xpack.encryptedSavedObjects.encryptionKey, a string of at least 32 characters, and it is self-managed only. If it is not set, Kibana generates a random key at startup, but alerting and action functions are blocked, and the alerting setup page lists the setting as something that must be added to kibana.yml on-premises. Because a random key changes at every restart, objects encrypted with an old key cannot be decrypted later. A highly available deployment must use the same key on every Kibana instance, and a key can be rotated without losing objects by listing the old ones in xpack.encryptedSavedObjects.keyRotation.decryptionOnlyKeys (Kibana uses them to decrypt only).

Two related settings:

  • xpack.security.encryptionKey (32 or more characters) encrypts session information; if unset a key is generated in memory and every session is invalidated at restart, and highly available deployments need the same value on every instance. Session defaults: idle timeout 3d and lifespan 30d on-premises.

  • server.publicBaseUrl makes notifications carry links back to Kibana; the alerting setup page names the footer link in alert e-mails. xpack.reporting.encryptionKey plays the same role for reports, and the lab sets it too.

Treat the keys as secrets: generate them with a random generator (for example openssl rand -base64 36), store them in the keystore or a secret manager, and keep a backup of them separate from the Elasticsearch snapshots, because without the old key the encrypted attributes of restored saved objects cannot be read. Rules also depend on who last saved them: a rule runs with an API key that captures the saving user’s privileges, which is why the next page recommends a dedicated service user for rules in production.

Source: Security settings (anchor #xpack-encryptedsavedobjects-encryptionkey), Alerting settings and Alerting setup (anchors #encryptionkey, #publicbaseurl and #api-keys). The later alerting pages continue in Alerting Setup, Security & Scaling.

What can go wrong

  • Starting without a stable encryption key. Rules and connectors cannot be used, or break at the next restart. Set the key before creating the first connector.

  • Version mismatch between the Kibana and Elasticsearch images; pin both to 9.5.6.

  • Password in the environment. Visible with ps and in docker inspect; use the keystore.

  • Custom kibana.yml masking image defaults. If Kibana becomes unreachable from outside the container after you mount a file, the file has replaced server.host: "0.0.0.0".

  • Wrong server.publicBaseUrl. Alert e-mails and webhook messages link to an unreachable host; include any server.basePath.

  • Recreating the container without the keystore volume. Secure settings stored in the generated keystore are gone.

  • verificationMode: none left on after a TLS experiment.

  • HTTP/2. With TLS enabled on Kibana, HTTP/2 is the default protocol since 9.0, and clients or proxies limited to HTTP/1 get a deprecation warning.

Verify it in the lab

  1. docker compose --profile kibana up -d, then docker compose ps: kibana-setup ends with exit code 0, elasticsearch is healthy and kibana is up.

  2. curl -s http://localhost:5601/api/status without credentials returns only a redacted overall level; with -u elastic:"$ELASTIC_PASSWORD" it returns the per-service breakdown (Elasticsearch, saved objects, plugins).

  3. Log in at http://localhost:5601 as elastic. Open Stack Management > Connectors and create a Server log connector: it saves without an error about the encryption key.

  4. docker compose exec kibana bin/kibana-keystore list shows the keystore that the image generated at startup (no entries); recreating the container without a volume on /usr/share/kibana/config and /usr/share/kibana/data discards it, which is why persisting it matters.

  5. Change KIBANA_SAVED_OBJECTS_KEY, recreate the kibana service and check that Kibana can no longer decrypt the connector’s secrets (restore the value afterwards); then rotate it properly with decryptionOnlyKeys.

In the books

The older books show the same first steps on much older versions. Learning ELK Stack (Chhajed) installs Kibana 4 from a tarball and edits config/kibana.yml for the port, the host and an Elasticsearch URL setting; Practice guide: Elastic from A to Z by examples (Melachi, Elastic 7.10) unzips Kibana on Windows and sets server.port and elasticsearch.url; Elasticsearch 7.0 Cookbook (Paro) has an "Installing Kibana" recipe. What has changed: the Elasticsearch connection is configured with elasticsearch.hosts, security is on by default and Kibana enrolls with a token, kibana_system or a service account token replaces unauthenticated access, alerting needs the encryption key, and Docker with the same version tag is the usual route. Publisher pages are in the bibliography.