How to Set Up Grafana on Ubuntu 24.04?
Introduction:
Grafana is a popular open-source monitoring and visualisation tool used to analyse metrics from various data sources such as Prometheus, MySQL, PostgreSQL, and Elasticsearch. It provides interactive dashboards, real-time graphs, and alerting features, making it widely used in DevOps and system administration environments.
Prerequisites:
- Sudo or root permissions
- Ubuntu 24.04 server
Procedure:
Step 1:
Before installing any application, update the package index to ensure the latest versions are used.
| $ sudo apt update && sudo apt upgrade -y |
Step 2:
Install the necessary dependencies for adding external repositories.
| $ sudo apt install -y apt-transport-https software-properties-common wget |
Step 3:
Add Grafana’s official GPG key to verify package authenticity.
| $ sudo mkdir -p /etc/apt/keyrings $ wget -q -O – https://apt.grafana.com/gpg.key | sudo gpg –dearmor -o /etc/apt/keyrings/grafana.gpg |
Step 4:
Add the official Grafana repository to the system.
| $ echo “deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main” | sudo tee /etc/apt/sources.list.d/grafana.list |
Step 5:
Update the repository list and install Grafana.
| $ sudo apt update $ sudo apt install grafana -y |
Step 6:
Start the Grafana service and enable it to run on system boot.
| $ sudo systemctl enable grafana-server $ sudo systemctl start grafana-server |
Verify service status:
| $ sudo systemctl status grafana-server |
Step 7:
Allow Grafana’s default port (3000) through the firewall.
| $ sudo ufw allow 3000/tcp $ sudo ufw reload |
Step 8:
Open a web browser and access:
http://IP-adress:3000
Default login credentials:
- Username: admin
- Password: admin
You will be prompted to change the password after the first login.
Conclusion:
Grafana installation on Ubuntu 24.04 is a straightforward process when using the official repository. Once installed, Grafana provides a powerful platform for monitoring, visualization, and alerting. By integrating it with data sources like Prometheus or databases, administrators can gain real-time insights into system performance and application health.
