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”.
- Select Instance Location:
- Choose the desired location for your server. For this tutorial, we’ll select “New York, USA”.
- 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”.
- 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.
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
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
Step 5: Install Grafana
Update the package lists and install Grafana:
apt update
apt install grafana -y
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
Step 7: Verify Grafana Service Status
Check the status of Grafana to ensure it’s running without issues:
systemctl status grafana-server
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.
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
Reload the firewall to apply the changes:
ufw reload
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.