How to Set Up Kibana on Ubuntu 18.04


by Thomas Tran



This article contains instructions to set up Kibana inside an Ubuntu 18.04 machine. It covers the installation process, networking, and memory allocation.

Install Kibana

The version of Kibana has to match the version of Elasticsearch you installed.

sudo apt-get update && sudo apt-get install kibana=7.13.3

Enable network access to port 5601

Kibana is served on port 5601 by default, so we’ll have to open that up.

sudo ufw allow 5601

sudo ufw enable

sudo ufw status

Lower allocated memory for Kibana

We don’t need that much memory for Kibana at the moment because we’re only using it for monitoring the Elasticsearch cluster. This could change in the future and you may have to adjust the memory allocation for it. Right now we’re setting the RAM to 800 megabytes.

sudo bash -c 'cat > /etc/kibana/node.options << EOF
--max-old-space-size=800
EOF'

Add configurations to kibana.yml

sudo bash -c 'cat > /etc/kibana/kibana.yml << EOF

server.host: "0.0.0.0" # binds to all IP addresses
server.name: "<a name for your kibana>"

elasticsearch.hosts: [ "https://<Elasticsearch IP>:9200" ]
elasticsearch.preserveHost: false

# Logging settings
logging.dest: /var/log/kibana
logging.rotate.enabled: true
logging.rotate.keepFiles: 7

elasticsearch.username: "kibana"
elasticsearch.password: "" # auto-generated by elasticsearch-setup-password
EOF'

Assign server.host=0.0.0.0 so that Kibana can bind to all IP addresses on the local machine, including the private IP that is used to access Kibana.

Optional: TLS/SSL

If you want to enable TLS/SSL between Kibana and Elasticsearch, copy Kibana certificates to the correct place. At the moment we’re not doing this, so the following is optional:

sudo mkdir /etc/kibana/certs

sudo cp /etc/elasticsearch/certs/elasticsearch-ssl-http/kibana/elasticsearch-ca.pem /etc/kibana/certs

Then allow the kibana user access to the certificate. If you don’t do this, you will get a “Permission denied” error when starting the daemon.

sudo chown -R kibana:kibana /etc/kibana/certs/elasticsearch-ca.pem

Create logging directory

By default Kibana cannot create its own logging directory at var/log/kibana so we’ll have to manually add it:

sudo touch /var/log/kibana

sudo chown -R kibana:kibana /var/log/kibana

Start Kibana

sudo systemctl daemon-reload

sudo systemctl enable kibana

sudo systemctl start kibana

Test curl

curl -XGET http://<PRIVATE IP>:5601/app/kibana

View latest Kibana logs

tail -f /var/log/kibana/kibana.log

The -f flag will attach the the bottom of the log and follow it as it changes.