In this tutorial, we will show you how to install and configure Munin on CentOS 7. For those of you who didn’t know, Munin is one of the most powerful monitoring systems for dedicated servers and cloud environments. It allows you to monitor your server and network activity by providing useful graphics of your CPU, Memory, Disk, Network Devices, and also running system services.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Munin Network Monitoring on a CentOS 7 server.
Prerequisites
- A server running one of the following operating systems: CentOS 7.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Munin on CentOS 7
Step 1. First, we need to add the EPEL repository to our system.
yum install epel-release
Step 2. Install LAMP (Linux, Apache, MariaDB, PHP) server.
A CentOS 7 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.
Step 3. Installing Munin Network Monitoring.
Let’s install Munin with yum:
yum install munin munin-node -y
Once the installation is complete, start its service and enable it at the auto start during reboot by using the following commands:
systemctl enable munin-node systemctl start munin-node
Step 4. Munin Configurations.
Now configure Munin by opening its default configuration using any editor as used in the below command:
nano /etc/munin/munin.conf
Add the following lines:
[localhost] address 127.0.0.1 use_node_name yes
The Munin statistics are protected with a username and password (Apache basic auth). In the next step, we add a new user and password to the /etc/munin/munin-htpasswd
file:
htpassd /etc/munin/munin-htpasswd admin
Configure Munin node as a monitoring target:
nano /etc/munin/munin-node.conf
Add the following lines at the end:
host_name munin.idroot.us
Step 5. Configuring Apache web server for Munin.
By default, Munin creates an Apache configuration file /etc/httpd/conf.d/munin.conf
. Edit Munin Apache configuration file and add the following content:
nano /etc/httpd/conf.d/munin.conf
Add the following lines:
<Directory /var/www/html/munin> AuthUserFile /etc/munin/munin-htpasswd AuthName "admin" AuthType Basic require valid-user Order Deny,Allow Deny from all Allow from 127.0.0.1 172.0.0.0/24 </Directory>
Now, we can restart the Apache webserver so that the changes take place:
systemctl restart httpd
Step 6. Accessing Munin.
Munin will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com/munin
or http://your-server-ip/munin
. Using ‘admin’ as username and the previously generated Munin password as password and you will be able to access Munin graphs and data.
Congratulations! You have successfully installed Munin. Thanks for using this tutorial for installing Munin Network Monitoring on your CentOS 7 system. For additional help or useful information, we recommend you to check the official Munin website.