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 theroot user
. We recommend acting as anon-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.