Grafana is an open-source analytics and monitoring platform that allows you to query, visualize, alert on, and understand your metrics. This guide will walk you through installing Grafana on Ubuntu 22.04 and securing the installation.

Step 1: Deploying a Cloud Instance on Shape.host

  • Log in to Shape.host Dashboard:
  • Navigate to the Shape.host website and log in to your account.
  • Create a New Instance:
  • Click on the “Create” button located at the top right corner of the dashboard.
  • From the dropdown menu, select “Instances”.
Shape.host Resources dashboard showing the Create menu and instance rebuild controls.
  • Select Instance Location:
  • Choose the desired location for your server. For this tutorial, we’ll select “New York, USA”.
Shape.host Create New Instance form with the available data center locations.
  • Choose a Plan:
  • Select a plan that fits your requirements. For example, you might choose a plan with 2 cores CPU, 2 GB Memory, and 50 GB SSD disk space.
  • Select an Operating System:
  • Scroll down to the “Choose an image” section and select “Ubuntu 22.04”.
Shape.host instance form with a server plan and Ubuntu image selected.
  • Configure Additional Options:
  • (Optional) You can configure additional options like User Data Configuration and IPv6 Networking.
  • Enter a hostname for your instance, e.g., “Tutorial Ubuntu”.
  • Click on the “Create instance” button to deploy the instance.
Shape.host instance form showing hostname, instance count and the Create Instance button.

Step 2: Connecting to Your Instance

  • Retrieve SSH Credentials:
  • Note the IP address of your newly created instance from the Shape.host dashboard.
  • Connect via SSH:
  • Open a terminal on your local machine.
  • Use the following command to connect to your instance:
    sh ssh root@your_instance_ip
  • Replace your_instance_ip with the actual IP address of your instance.

Step 3: Add the Grafana GPG Key

First, add the Grafana GPG key to verify package integrity:

curl -fsSL https://packages.grafana.com/gpg.key | gpg --dearmor -o /usr/share/keyrings/grafana-archive-keyring.gpg
Terminal showing curl commands or output during Add the Grafana GPG Key.

Step 4: Add Grafana Repository

Next, add the Grafana repository to your APT sources list:

echo "deb [signed-by=/usr/share/keyrings/grafana-archive-keyring.gpg] https://packages.grafana.com/oss/deb stable main" | tee /etc/apt/sources.list.d/grafana.list
Terminal showing curl commands or output during Add Grafana Repository.

Step 5: Install Grafana

Update the package lists and install Grafana:

apt update
apt install grafana -y
Terminal showing APT package management commands and output.

Step 6: Start and Enable Grafana Service

Start the Grafana service and enable it to start on boot:

systemctl start grafana-server
systemctl enable grafana-server
Terminal showing systemd service management commands or output.

Step 7: Verify Grafana Service Status

Check the status of Grafana to ensure it’s running without issues:

systemctl status grafana-server
Terminal showing systemd service management commands or output.
Terminal showing systemd service management commands or output.

Step 8: Access Grafana Web Interface

Open your web browser and navigate to http://your_server_ip:3000. Replace your_server_ip with your server’s IP address. You should see the Grafana login page.

  • Username: admin
  • Password: admin

Upon login, Grafana will prompt you to change the default password.

Grafana sign-in form.

Step 9: Optional – Configure Firewall

If you have a firewall enabled, allow traffic on port 3000 (default Grafana port):

ufw allow 3000/tcp 
ufw enable
Terminal showing firewall configuration commands and rules.
Terminal showing firewall configuration commands and rules.

Reload the firewall to apply the changes:

ufw reload
Terminal showing firewall configuration commands and rules.

By following these steps, you should successfully install and secure Grafana on your Ubuntu 22.04 server hosted on Shape.host’s Cloud VPS. This setup provides you with a powerful platform for visualizing and monitoring your metrics. For further customization and advanced configurations, refer to the Grafana documentation.