What is Munin?

Munin is an open-source monitoring tool that tracks system performance metrics like CPU usage, memory utilization, and network traffic. It provides detailed visualizations, helping you monitor and troubleshoot issues across multiple nodes from a central server.

Step 1: Prepare Instance Steps

Before proceeding, ensure your virtual machine is set up:

Initiating Instance Creation:

Start a new virtual machine instance on your chosen hosting platform.

Shape.host Resources dashboard showing the Create menu and available instance templates.

Choosing a Location:

Select your preferred data center location.

Shape.host instance form with Amsterdam selected as the data center location.

Selecting a Plan:

Choose an appropriate hosting plan and select Ubuntu 22.04 as the OS.

Shape.host instance form with the $22 monthly plan and Ubuntu image selected.

Authentication Method:

Set up authentication using SSH keys or a password, and complete the instance creation.

Shape.host instance form showing authentication, hostname and instance creation options.

Connecting to Your Instance:

Use SSH to connect to your server with the provided IP address.

Step 2: Update and Upgrade Your System

First, update your package list and upgrade installed packages:

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

Step 3: Install Apache and Required Packages

Install Apache along with necessary utilities and modules:

apt install apache2 apache2-utils libcgi-fast-perl libapache2-mod-fcgid -y
a2enmod fcgid
systemctl restart apache2
Terminal showing APT package management commands and output.
Terminal showing an Apache module enablement command.
Terminal showing systemd service management commands or output.

Step 4: Install Munin

Now, install Munin and its related packages:

apt install munin munin-node munin-plugins-extra -y
Terminal showing APT package management commands and output.

Step 5: Set Up Authentication

Create an admin user for Munin using HTTP basic authentication:

htpasswd -c /etc/munin/munin-htpasswd admin
Terminal showing an HTTP authentication password-file command.

Step 6: Configure Apache for Munin

Copy the default Munin Apache configuration file and edit it to include authentication settings:

cp -p /etc/munin/apache24.conf /etc/apache2/sites-available/munin.conf
nano /etc/apache2/sites-available/munin.conf
Terminal showing cp commands or output during Configure Apache for Munin.
Terminal showing nano commands or output during Configure Apache for Munin.

In the configuration file, modify or add the following settings:

ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
Alias /munin/static/ /var/cache/munin/www/static/

<Directory /var/cache/munin/www>
    AuthUserFile /etc/munin/munin-htpasswd
    Authtype Basic
    AuthName "Munin"
    Require valid-user
    Options FollowSymLinks SymLinksIfOwnerMatch
    Options None
</Directory>

<Directory /usr/lib/munin/cgi>
    AuthUserFile /etc/munin/munin-htpasswd
    Authtype Basic
    AuthName "Munin"
    Require valid-user
    Options FollowSymLinks SymLinksIfOwnerMatch

    <IfModule mod_fcgid.c>
        SetHandler fcgid-script
    </IfModule>
    <IfModule !mod_fcgid.c>
        SetHandler cgi-script
    </IfModule>
</Directory>
Terminal showing an HTTP authentication password-file command.

Step 7: Enable Munin Site and Restart Services

Enable the Munin site configuration and restart Apache and Munin services:

a2ensite munin
systemctl restart apache2
systemctl restart munin-node
Terminal showing the Apache command to enable the Munin site.
Terminal showing systemd service management commands or output.

Step 8: Verify Installation

Finally, check that Munin and Apache are running correctly:

systemctl status munin-node
systemctl status apache2
Terminal showing systemd service management commands or output.
Terminal showing systemd service management commands or output.

Step 9: Accessing Munin from the Web

After configuring and restarting the necessary services, you can access the Munin monitoring interface through your web browser.

  1. Open your web browser.
  2. Navigate to http://your-server-ip/munin.

You will be prompted to enter the username and password you set up during the authentication step (admin and the password you created). Once logged in, you will see the Munin dashboard displaying various system metrics and performance graphs.

This interface will help you monitor the health and performance of your server.

Browser HTTP authentication prompt for the Munin interface.
Munin overview page with monitoring categories and host links.

By following these steps, you will have successfully installed and configured Munin on your Ubuntu 22.04 server. Munin provides comprehensive system monitoring with easy-to-read graphs, making it an essential tool for managing your infrastructure.

For reliable hosting services, consider using Shape.host’s Cloud VPS services, which offer flexible and scalable solutions perfect for all your projects.