How to Install Monit on CentOS 8

Install Monit on CentOS 8

In this article, we will have explained the necessary steps to install and configure Monit on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Monit is an open source process tool for Linux operating system which helps you to monitor system process using a web browser and also whenever requires it automatically do the maintenance or repair of the particular process in such a way that it can be brought back online. Monit can also be used for managing and monitoring of programs, files directories, and devices for timestamps changes, checksum changes, or size changes.

Install Monit on CentOS

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo dnf update

Step 2. Install Monit.

Before the installation of Monit, clear the dependencies by installing the following:

sudo dnf install -y git gcc glibc make glibc-devel kernel-headers autoconf automake libtool bison flex libzip-devel pam-devel openssl openssl-devel

Next, clone the Monit source code for compiling:

git clone

Then, compiling Monit using following command:

cd monit
make install

Step 3. Configure Monit.

Copy the monitrc file from the downloaded source to /etc directory:

cp monitrc /etc/

Now make a few changes to the Monit configuration file for our requirements:

nano /etc/monitrc
set daemon 30
set mailserver port 25

Ensure to uncomment the below line. We will place service monitoring files here:

include /etc/monit.d/*

Step 4. Configure Monit Web Interface.

First, edit the Monit’s configuration file /etc/monitrc:

nano /etc/monitrc
set httpd port 2812 and
    use address       # only accept connection from localhost (drop if you use M/Monit)
    allow          # allow localhost to connect to the server and
    allow admin:monit         # require user 'admin' with password 'monit'
    #with ssl {               # enable SSL/TLS and set path to server certificate
    #pemfile: /etc/ssl/certs/monit.pem

Then, create a systemd file to auto start Monit on system startup:

nano /lib/systemd/system/monit.service
# This file is systemd template for monit service. To
 # register monit with systemd, place the monit.service file
 # to the /lib/systemd/system/ directory and then start it
 # using systemctl (see below).
 # Enable monit to start on boot:
 #         systemctl enable monit.service
 # Start monit immediately:
 #         systemctl start monit.service
 # Stop monit:
 #         systemctl stop monit.service
 # Status:
 #         systemctl status monit.service

 Description=Pro-active monitoring utility for unix systems

 ExecStart=/usr/local/bin/monit -I
 ExecStop=/usr/local/bin/monit quit
 ExecReload=/usr/local/bin/monit reload
 Restart = on-abnormal


You can execute the following commands to start Monit service:

systemctl daemon-reload
systemctl start monit
systemctl enable monit

Step 5. Configure Firewall for Monit.

Configure the firewall to allow access to the Monit web interface, running on port 2812.

firewall-cmd --permanent --add-port=2812/tcp
firewall-cmd --reload

Step 6. Accessing Monit Web Interface.

Now open your web browser and access the Monit by the URL: http://your-ipaddress:2812. Enter the username and password which you have entered in the file monit.conf. After login, it will display the Monit monitoring page.

Congratulation, you have learned how to install and configure Monit on CentOS 8. If you have any question, please leave a comment below.