In this tutorial, we will show you how to install Monit on Ubuntu 18.04 LTS. For those of you who didn’t know, Monit is an open-source process monitoring tool for Linux operating system that monitors the system processes for problems. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. Monit has built-in a lightweight HTTP(S) interface you can use to browse the Monit server and check the status of all monitored services. From the web interface, you can start, stop and restart processes and disable or enable monitoring of 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 Monit on an Ubuntu 18.04 (Bionic Beaver) server.
Prerequisites
- A server running one of the following operating systems: Ubuntu 18.04 (Bionic Beaver).
- 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 Monit on Ubuntu 18.04 LTS Bionic Beaver
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Installing Monit on Ubuntu 18.04.
Download and install Monit using the APT command from the Ubuntu repository:
sudo apt install monit
Step 3. Configure Monit monitoring tool.
Once the installation is complete, edit the file for Monit configuration. You can make a few changes to this configuration file for your requirement:
sudo nano /etc/monit/monitrc
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
*Note, the username is admin
and the password is monit
. You can also change the port number to a number of your choice.
*The configuration file is pretty self-explaining, if you are unsure about an option, take a look at the Monit documentation.
Next, enable Monit to start up automatically on boot with the command below:
sudo systemctl restart monit sudo systemctl enable monit
Step 4. 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 the conf above.
Congratulations! You have successfully installed Monit. Thanks for using this tutorial for installing the Monit monitoring tool on Ubuntu 18.04 LTS Bionic Beaver system. For additional help or useful information, we recommend you to check the official Monit website.