Monitoring and visualizing real-time data has become crucial for businesses to make data-driven decisions. Several tools exist to achieve this goal, including paid ones. Grafana is one such tool; however, it’s free and open-source. It stands out from other analytics tools with its flexibility to connect to a wide range of data sources and its highly customizable, interactive dashboards. Unlike many paid tools, Grafana’s open-source model provides powerful visualization at no cost, making it a scalable choice for teams of all sizes.
In this guide, we’ll cover the step-by-step installation process of Grafana using the official Grafana APT repository. Let’s dive into the process to get your Grafana instance up and running.
Prerequisites
Note: The above prerequisites are highly variable across use cases. A high-end configuration should be used for a large-scale deployment.
Step-by-step process to install Grafana on Ubuntu 22.04
For the purpose of this tutorial, we’ll be using a CPU-powered Virtual Machine by NodeShift since it provides Compute Virtual Machines at a very affordable cost on a scale that meets GDPR, SOC2, and ISO27001 requirements. Also, it offers an intuitive and user friendly interface, making it easier even for beginners to get started with Cloud deployments. However, feel free to use any cloud provider of your choice, and follow the same steps for the rest of the tutorial.
Step 1: Setting up a NodeShift Account
Visit NodeShift Platform and create an account by filling in basic details, or continue signing up with your Google/GitHub account.
If you already have an account, login straight to your dashboard.
Step 2: Create a Compute Node (CPU Virtual Machine)
After accessing your account, you should see a dashboard (see image), here:
- Navigate to the menu on the left side.
- Click on the Compute Nodes option.
- Click on Start to start creating your very first compute node.
These Compute nodes are CPU powered virtual machines by NodeShift. These nodes are highly customizable, and let you control different environmental configurations, such as CPUs, RAM and storage, according to your needs.
Step 3: Select configuration for VM
-
The first option you see is the Reliability dropdown, which lets you choose the type of uptime guarantee level you’re seeking for your VM (e.g., 99%).
-
Next, select a geographical region from the Region dropdown, where you want to launch your VM (e.g. United States).
-
Now, most importantly, select the right specifications for your VM according to your use-case by sliding the bars for each option.
Step 4: Choose VM Configuration and Image
-
After you select your required configuration options, you’ll see the available VMs in your region and as per (or very close to) your configuration. In our case, we’ll choose a ‘4 vCPUs/4GB/80GB SSD’ Compute node as the best possible match.
-
Next, you’ll need to choose an image for your Virtual Machine. For the scope of this tutorial, we’ll select Ubuntu, but you can choose any other option for setting up Grafana.
Step 5: Choose the Billing cycle and Authentication Method
-
For the billing cycle, two options are available: Hourly being ideal for short-term usage, offering pay-as-you-go flexibility, and Monthly being best for long-term projects with consistent usage rate and potentially lower cost.
-
Next, you’ll need to select an authentication method. There are two methods available: Password and SSH Key. We recommend using SSH keys as they are more secure option. In order to create one, head over to our official documentation.
Step 6: Finalize Details and Create Deployment
Finally, if you may want, you can also add a VPC (Virtual Private Cloud), which provides an isolated section for you to launch your cloud resources (Virtual machine, storage, etc.) in a secure, private environment. We’re keeping this option as default for now, but feel free to create a VPC as per your needs.
Also, you can deploy multiple nodes at once by clicking +
in the Quantity tab.
That’s it! Now, you are ready to deploy the node. Finalize the configuration summary, if it looks good, go ahead and click Create to deploy the node.
Step 7: Connect to active Compute Node using SSH
As soon as you create the node, it will take few seconds or a minute to get deployed. Once it is deployed, you will see a status Running in green, meaning that our Compute node is ready to use!
Once your node shows this status, follow the below steps to connect to the VM via SSH:
1) Open your terminal and run the below SSH command:
(replace root
with your username and paste the IP of your VM in place of ip after copying it from the NodeShift dashboard)
ssh root@ip
2) If SSH keys are set up, the terminal will authenticate automatically.
3) In some cases, your terminal may take your consent before connecting, enter ‘yes’, and you should be connected.
Step 8: Install Dependencies for Grafana
Before we move on to install Grafana, we first need to perform some prerequisites steps to set up dependencies which are required to install Grafana.
1) Let’s start by updating the Ubuntu package source list for the latest version and security updates
sudo apt update
Output:
2) Install the required packages
sudo apt install -y apt-transport-https software-properties-common wget
Output:
3) Add Grafana GPG Key
For secure APT package management, we’ll download and store GPG Key using the following commands:
a) Create a directory to store the key
sudo mkdir -p /etc/apt/keyrings/
b) Download, convert, and store the key
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
4) Add Grafana APT repository and update package list again
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt update
Output:
Step 9: Install Grafana
Once you are done with the above steps, you can proceed with the installation of Grafana
sudo apt install grafana
Output:
Step 10: Start and Enable Grafana
After the Grafana installation is complete, we will proceed to start and enable Grafana so that we can access its service.
1) Let’s first verify the installation by logging the version:
sudo grafana-server -v
Output:
2) Start Grafana server
sudo systemctl start grafana-server
3) Enable the server
sudo systemctl enable grafana-server
Output:
4) Verify the status
sudo systemctl status grafana-server
Output:
As you can see, our Grafana server is successfully up and running.
Now, let’s move on to access the Grafana service and see how the web interface looks like.
Step 11: Access the Grafana Web Interface
Follow the below steps to seamlessly access the Grafana service on your Ubuntu VM and start using it.
1) Configure the port on the firewall.
Use the below three commands one by one to enable the firewall and allow access to Grafana
sudo ufw enable
sudo ufw allow ssh
sudo ufw allow 3000/tcp
Output:
2) Access the web interface
Open a browser and paste the URL below to access Grafana’s web interface
(replace ip
with your server’s IP address/hostname)
http://ip:3000
Once loaded, you should see an interface like this:
Use the following as your “first-time login” credentials to log in to the dashboard:
-
username: admin
-
password: admin
After you successfully log in using the above credentials, it will ask you to create your own new password for security concerns.
Once you create your new password and submit it, it will take you to Grafana’s dashboard, which looks something like this:
Congratulations, your Grafana web service is successfully set up and ready for you to take your data insights to the next level!
Conclusion
Implementing Data-driven decisions can prove to be very powerful for the growth of a business. A tool like Grafana can double the results when set up and utilized correctly. In this article, we covered an easy and optimized approach to deploying a powerful VM like Ubuntu on NodeShift and setting up a Grafana server on top of it. In addition to saving cost by using an open-source tool like Grafana, this approach enables you to set up a compute-heavy and efficient Ubuntu Virtual Machine on a robust and affordable cloud platform like NodeShift without any up-front costs or technical specialties.
For more information about NodeShift:
Source link
lol