LinuxTutorialsUbuntu

How To Install Grafana on Ubuntu 18.04 LTS

Install Grafana on Ubuntu 18.04

In this tutorial, we will show you how to install Grafana on Ubuntu 18.04 LTS.  For those of you who didn’t know, Grafana is an open-source data visualization and tracking suite. It offers support for Graphite, Elasticsearch, Included, Prometheus, and a lot more databases. The application gives a beautiful dashboard and metric analytics, with the capability to control and create your own dashboard for your own apps or infrastructure performance monitoring.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Grafana on the Ubuntu 18.04 server.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 18.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Grafana on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Install Grafana on Ubuntu 18.04.

Grafana is not available in Ubuntu’s default repository. Therefore, to get started, you must add the Grafana repository to Ubuntu 18.04 system:

echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
curl https://packages.grafana.com/gpg.key | sudo apt-key add -

The next step is to perform an update on the Grafana repository, then install the application using the command below:

sudo apt install -y apt-transport-https grafana

Start and enable grafana-server service to start on boot:

sudo systemctl enable --now grafana-server

Check status to confirm that it is running:

systemctl status grafana-server.service

The output should look like this:

grafana-server.service - Grafana instance
    Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2019-10-02 07:59:24 CET; 29s ago
      Docs: http://docs.grafana.org
  Main PID: 24336 (grafana-server)
     Tasks: 8 (limit: 3399)
    CGroup: /system.slice/grafana-server.service
            └─24336 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=deb cfg:default
 Oct 02 08:46:25 ubuntu-2gb-nbg1-1 grafana-server[24336]: t=2019-10-02T07:59:25+0100 lvl=info msg="Initializing QuotaService" logger=server
 Oct 02 08:46:25 ubuntu-2gb-nbg1-1 grafana-server[24336]: t=2019-10-02T07:59:25+0100 lvl=info msg="Initializing ServerLockService" logger=server
 Oct 02 08:46:25 ubuntu-2gb-nbg1-1 grafana-server[24336]: t=2019-10-02T07:59:25+0100 lvl=info msg="Initializing UserAuthTokenService" logger=server
 Oct 02 08:46:25 ubuntu-2gb-nbg1-1 grafana-server[24336]: t=2019-10-02T07:59:25+0100 lvl=info msg="Initializing CleanUpService" logger=server
 Oct 02 08:46:25 ubuntu-2gb-nbg1-1 grafana-server[24336]: t=2019-10-02T07:59:25+0100 lvl=info msg="Initializing NotificationService" logger=server
 Oct 02 08:46:25 ubuntu-2gb-nbg1-1 grafana-server[24336]: t=2019-10-02T07:59:25+0100 lvl=info msg="Initializing ProvisioningService" logger=server
 Oct 02 08:46:25 ubuntu-2gb-nbg1-1 grafana-server[24336]: t=2019-10-02T07:59:25+0100 lvl=info msg="Initializing TracingService" logger=server
 Oct 02 08:46:25 ubuntu-2gb-nbg1-1 grafana-server[24336]: t=2019-10-02T07:59:25+0100 lvl=info msg="Initializing Stream Manager"
 Oct 02 08:46:25 ubuntu-2gb-nbg1-1 grafana-server[24336]: t=2019-10-02T07:59:25+0100 lvl=info msg="HTTP Server Listen" logger=http.server address=0.0.0.
 Oct 02 08:46:25 ubuntu-2gb-nbg1-1 grafana-server[24336]: t=2019-10-02T07:59:25+0100 lvl=info msg="cleanup of expired auth tokens done" logger=auth coun

Step 3. Configure Firewall for Grafana.

Grafana’s default HTTP port is 3000, you’ll need to allow access to this port on the firewall:

sudo ufw enable
sudo ufw allow 3000/tcp

Step 4. Accessing Grafana.

Grafana will be available on HTTP port 3000 by default. Open your favorite browser and navigate to http://mydomain.com:3000 and complete the required steps to finish the installation. Enter your admin credentials (username and password) for Grafana, in this case, use “admin” in both cases, then press the login.

Congratulations! You have successfully installed Grafana. Thanks for using this tutorial for installing the Grafana monitoring tool on your Ubuntu 18.04 system. For additional help or useful information, we recommend you check the official Grafana website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button