How To Install Monit on CentOS 6

Install Monit on CentOS 6

In this tutorial, we will show you how to install Monit on CentOS 6. For those of you who didn’t know, Monit is an open-source process tool for Linux operating system which helps you to monitor system process using a web browser 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. The monitoring can be directly on the command line or on the web. You can assign Monit multiple tasks (not only monitoring), so if a certain service fails the check, Monit can alert or do something about it (try to restart the service for example).

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 Monit on CentOS 6.


  • A server running one of the following operating systems: CentOS 6.
  • 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 the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Monit on CentOS 6

Step 1. First, you need to enable the EPEL repository on your system.

## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm

Step 2. Installing Monit.

yum update
yum install -y libcrypto.so.6 libssl.so.6
yum install monit

Step 3. Configure Monit.

Once the installation is complete, edit the main config file to resemble the example below using your favorite text editor and set your own username and password:

nano /etc/monit.conf
set httpd port 2812 and  # # set the listening port to your desire.
use address localhost    # only accept connection from localhost
allow localhost          # allow localhost to connect to the server and
allow admin:monit        # require user 'admin' with password 'monit'
allow @monit             # allow users of group 'monit' to connect (rw)
allow @users readonly    # allow users of group 'users' to connect readonly

Once you’ve configured it, you need to start the Monit service to reload the new configuration settings:

/etc/init.d/monit start

Step 4. Configuring Programs Self-Monitoring.

After the initial config is completed, we can configure some of the services we want to monitor. To do this, we will create separate files for every service located within the /etc/monit.d/ directory. Following are some useful configuration examples for Monit, that can be very helpful to see how a service is running, where it keeps its pidfile and how to start and stop a service etc:

## webserver ##
# nano /etc/monit.d/http
check process webserver with pidfile /var/run/httpd/httpd.pid
group apache
start program = “/etc/init.d/httpd start”
stop  program = “/etc/init.d/httpd stop”
if failed host port 80 then restart
## SSH ##
# nano /etc/monit.d/ssh
start program  “/etc/init.d/sshd start”
stop program  “/etc/init.d/sshd stop”
if failed port 22 protocol ssh then restart
## NTP ##
# nano /etc/monit.d/ntp
check process ntpd with pidfile /var/run/ntpd.pid
start program = “/etc/init.d/ntpd start”
stop  program = “/etc/init.d/ntpd stop”
if failed host port 123 type udp then alert

After creating the desired configuration files, test the control file for syntax errors:

monit -t

And start Monit by simply typing:


Step 5. Accessing Monit.

Monit will be available on HTTP port 2812 by default. Open your favorite browser and navigate to http://your-domain.com:2812 or http://your-server-ip:2812 and then enter the credentials you created in /etc/monit.conf.

Congratulations! You have successfully installed Monit. Thanks for using this tutorial for installing Monit on CentOS 6 system. For additional help or useful information, we recommend you check the official Monit website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button