How to Install Grafana on Linux Server for DevOps Monitoring (Step-by-Step Beginner Guide)
If you're setting up monitoring for your Linux server, Grafana is one of the best tools you can use. In this guide, you’ll learn how to install Grafana on a Linux server step by step, with real commands and simple explanations that are easy to follow—even if you're just starting out.
Step 1: Update Your Linux Server
Start by updating your system to make sure all packages are up to date and secure.
sudo apt update sudo apt upgrade -y
If you encounter a 429 Too Many Requests error while running apt update or apt upgrade, it’s a common issue. You can fix it easily by following this guide:
How to Fix 429 Too Many Requests Error in Ubuntu APT Update
This ensures your server is running the latest updates and avoids installation issues later.
Step 2: Install Required Packages
sudo apt install wget curl software-properties-common net-tools -y
These tools help with downloading Grafana and checking network-related configurations.
Step 3: Add Grafana Repository
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
Step 4: Install Grafana
sudo apt update sudo apt install grafana -y
Step 5: Start and Enable Grafana Service
sudo systemctl start grafana-server sudo systemctl enable grafana-server sudo systemctl status grafana-server
Step 6: Verify Grafana Port
netstat -tpln
Step 7: Access Grafana in Browser
http://your-server-ip:3000
- Username: admin
- Password: admin
Step 8: First Password Change
After logging in with the default credentials, Grafana will prompt you to change the password. This is an important security step and should not be skipped.
Step 9: Grafana Dashboard
Step 10: Configure Firewall
If you want to access Grafana from an external network or public IP, you need to allow port 3000 through the firewall.
sudo ufw enable sudo ufw allow 3000/tcp sudo ufw reload
This step ensures that external users can access the Grafana dashboard securely through your server’s IP address.
Final Thoughts
Installing Grafana on a Linux server is a valuable DevOps skill. By following this step-by-step approach, you ensure everything is working correctly in a real-world setup.
Frequently Asked Question
Is Grafana free to use?
Yes, Grafana offers a free and open-source version that you can install on a Linux server for monitoring and visualization.
What port does Grafana run on by default?
Grafana runs on port 3000 by default. You need to allow this port in your firewall if you want to access it from outside your server.
How can I check if Grafana is running?
sudo systemctl status grafana-server
This command shows whether the Grafana service is active and running on your system.
Why is the first password change important?
Grafana uses default credentials for the first login. Changing the password immediately helps protect your dashboard from unauthorized access.
Do I always need to configure the firewall?
No. Firewall configuration is only required if you want to access Grafana from an external network. For local or internal use, it may not be necessary.