Installing Grafana on Ubuntu Server
Ubuntu is one of the most popular operating systems for servers, so we will learn how to install Grafana on it.
Installing Grafana on Ubuntu is a very straightforward procedure because there are Ubuntu packages.
Installation instructions
Let’s look at what we need to do here:
- As before, we first run updates:
$ sudo apt-get update $ sudo apt-get upgrade
- Next, if you do not have
wget
installed on your server, you can install it as follows:$ sudo apt-get install apt-transport-https $ sudo apt-get install software-properties-common wget
- Then you can use
wget
to download the GPG key and add it to the APT keys. In this way, you authorize Grafana packages to be installed on the system:$ wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add –
- After that, you can add the Grafana repository (stable release) to the APT source list:
$ echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
- Finally, run the following commands:
$ sudo apt-get update $ sudo apt-get install grafana
Now that you have installed Grafana on Ubuntu Server, let’s see how to run it.
Running Grafana on Ubuntu Server
There are two ways of running Grafana as a service. Let’s have a look at them.
Running Grafana using systemd
Grafana services can be managed by systemd
.
To start Grafana, simply execute the following:
$ sudo systemctl start grafana-server
To see the Grafana service status, run this command:
$ sudo systemctl status grafana-server
To stop the service, use this command:
$ sudo systemctl stop grafana-server
And to enable start at boot, use this command:
$ sudo systemctl enable grafana-server.service
Now that you know how to do it with systemd
, let’s see how to do it with initd
.
Running Grafana with initd
You can run Grafana as follows:
$ sudo service grafana-server start
To stop Grafana, use this command:
$ sudo service grafana-server stop
To get the service status, run this command:
$ sudo service grafana-server status
To configure it to start at boot, use the following command:
$ sudo update-rc.d grafana-server defaults
You have now installed and executed Grafana on Ubuntu Server. You also configured it to start on boot. Now let’s see how to access Grafana from a browser.
Accessing Grafana
Before trying to access Grafana, make sure that the service is running. You can check it using the preceding commands. If it is stopped, you must start it as shown earlier.
As soon as you have Grafana installed and running, you can access it by pointing the browser to http://your-server-ip-or-name:3000.
The default credentials are admin
/admin
.
Now that you have learned how to install and run Grafana on Ubuntu Server as well as how to manage start-up at boot using two different methods, let’s move on to the next section, where you will learn how to deploy Grafana using Docker.