In this tutorial, we will show you how to install Monit on CentOS 8. For those of you who didn’t know, Monit is an open-source process tracking tool for Linux OS that helps you to monitor the processes by the system. It automatically does the maintenance and repair of the particular process and ensures it is brought back online. Monit also can be used for handling and monitoring of packages, files, directories, filesystems, TCP/IP network exams, protocol assessments, and can make use of SSL for such tests.
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 through the step-by-step installation of the Monit monitoring system on a CentOS 8.
Install Monit on CentOS 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update sudo dnf install zlib-devel pam-devel openssl-devel libtool bison flex autoconf gcc make git epel-release
Step 2. Installing Monit on CentOS 8.
Now run the following command to install Monit to your CentOS system:
sudo dnf install monit
To starting Monit is as simple as running one command:
$sudo monit ###You should see the message below in the end### New Monit id: ak47bmwe46857bcf3c5g0detd225e83 Stored in '/root/.monit.id' Starting Monit 5.46.0 daemon with http interface at [localhost]:2812
You can as well enable Monit to start when the server restarts:
sudo systemctl enable --now monit
Step 3. Configure Monit.
Monit comes with a configuration that allows you to fine-tune the configuration and add what we need to monitor.
sudo nano /etc/monitrc
Look for httpd port 2812, modify the following entries:
set httpd port 2812 #use address localhost => only accept connection from localhost (drop if you use M/Monit) use address 0.0.0.0 allow 0.0.0.0/0 allow admin:monit
From the above settings, Monit will listen on port 2812 on all interfaces. The admin user will able to access the web interface from any network.
Step 4. Configure Firewall.
Configure the firewall to allow access to the Monit web interface, running on port 2812:
sudo firewall-cmd --permanent --add-port=2812/tcp sudo firewall-cmd --reload
Step 5. Accessing Monit on CentOS.
Monit will be available on HTTP port 2812 by default. Open your favorite browser and navigate to
http://your-server-ip-address:2812 and then enter the credentials you created in
Congratulations! You have successfully installed Monit. Thanks for using this tutorial for installing the Monit monitoring tool on your CentOS 8 system. For additional help or useful information, we recommend you check the official Monit website.