What is Grafana?
Grafana is a free tool that draws charts and dashboards from your data. A dashboard is one screen with many charts, like the dials in a car. People use Grafana to watch how a server is doing, such as how busy its processor is.
Steps
- Log in to your server with SSH. SSH lets you type commands on a remote computer.
- Install the helper tools.
apt update apt install -y apt-transport-https software-properties-common wget gnupg - Create a folder for the signing key. The key proves the software is real.
mkdir -p /etc/apt/keyrings - Download and save the Grafana key.
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | tee /etc/apt/keyrings/grafana.gpg > /dev/null - Add the Grafana software source.
This tells Ubuntu where to find Grafana.echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | tee /etc/apt/sources.list.d/grafana.list - Refresh the list and install Grafana.
apt update apt install -y grafana - Start Grafana and make it start again after every reboot.
systemctl enable --now grafana-server - Check that it is running.
systemctl status grafana-server - If a firewall is on, allow port 3000. A port is like a numbered door into your server. For example, with UFW:
ufw allow 3000/tcp - Open a browser and go to
http://YOUR-SERVER-IP:3000. Use the IP address from your welcome email. - Log in with the user name
adminand the passwordadmin. - Grafana asks you to set a new password. Choose a strong one.
Tip: Grafana only shows data after you add a data source, such as Prometheus or MySQL. In Grafana, open the menu, then Connections, and add one. Using a domain name and HTTPS in front of Grafana is safer for real use.
Quick recap
- Grafana turns data into charts.
- Add the Grafana software source and install with apt.
- Start it with
systemctl enable --now grafana-server. - Open port 3000 in your browser and change the default password.