How to Install Monit on Ubuntu 26.04, 24.04 and 22.04

Last updated Saturday, March 21, 2026 9:43 am 8 min read

A service that dies quietly at 2 a.m. is easy to miss until users start reporting downtime. Monit gives Ubuntu a lightweight watchdog for processes, ports, and resource thresholds, so you can install Monit on Ubuntu when you want automatic restarts and basic self-healing without deploying a larger monitoring stack.

Ubuntu 26.04, 24.04, and 22.04 all ship Monit in the default repositories, with slightly different package versions and service integration across those LTS releases. That setup installs Monit, enables the daemon, turns on the optional web interface, limits access to port 2812, and extends cleanly into troubleshooting, updates, and removal.

Update Ubuntu Before Monit Installation

Refresh package metadata first so Ubuntu installs the current Monit build for your release.

sudo apt update

These commands use sudo because they modify system packages and services. If your account does not have sudo access yet, follow the guide to add a new user to sudoers on Ubuntu or run the commands from a root shell.

Upgrade any already-installed packages before adding another long-running service.

sudo apt upgrade

Install Monit on Ubuntu

Monit comes from Ubuntu’s Universe component, so you do not need a separate download or third-party repository. Most standard Ubuntu installations already have Universe enabled, but minimal images can differ; if Monit does not show a candidate package, first enable Universe and Multiverse on Ubuntu.

Ubuntu ReleaseDefault Monit PackageService IntegrationBest Fit
Ubuntu 26.04Monit 5.35.2Native systemd unitNewest LTS package and cleanest service behavior
Ubuntu 24.04Monit 5.33.0Native systemd unitCurrent mainstream LTS deployment baseline
Ubuntu 22.04Monit 5.31.0Generated SysV wrapper behind systemctlOlder LTS estates that still need Monit supervision

The install command is the same on Ubuntu 26.04, 24.04, and 22.04. What changes between releases is the packaged Monit version and, on 22.04, the unit details shown by systemctl.

Install Monit from the Ubuntu repository with APT.

sudo apt install monit

Check the installed Monit build before you move on to the service and web interface steps.

monit --version
This is Monit version 5.35.2
Built with ssl, with ipv6, with compression, with pam and with large files

Ubuntu 24.04 reports This is Monit version 5.33.0, and Ubuntu 22.04 reports This is Monit version 5.31.0 on the first line.

Enable the daemon immediately so Monit starts at boot and begins its polling cycle.

sudo systemctl enable monit --now

Ubuntu 26.04 and 24.04 use a native /usr/lib/systemd/system/monit.service unit. Ubuntu 22.04 still works with systemctl, but it exposes Monit through a generated wrapper backed by /etc/init.d/monit, so the loaded-path details look different.

Use the enabled and active states as the first quick health check.

systemctl is-enabled monit
systemctl is-active monit
enabled
active

Configure Monit Web Interface on Ubuntu

Monit does not listen on TCP port 2812 right after installation because the package ships its set httpd block commented out. Turn that block on before you expect the Monit web interface or the full Monit CLI command set to respond.

Back up the control file first so you can restore the package defaults if you want a clean starting point later.

sudo cp /etc/monit/monitrc /etc/monit/monitrc.bak

Open the Monit control file in a text editor.

sudo nano /etc/monit/monitrc

Look for the default HTTP section near the middle of the file. It starts commented out like this:

#set httpd port 2812 and
#    use address localhost  # only accept connection from localhost
#    allow localhost
#    allow admin:monit

A good starting point is a localhost-only setup with one explicit login. Replace the sample password before saving the file, and keep the password in quotes if you use special characters.

set httpd port 2812 and
    use address localhost
    allow localhost
    allow monitadmin:"change-this-password"

That configuration keeps Monit bound to 127.0.0.1 and ::1, which is the safest default for server administration. If you want a browser on another machine to reach Monit directly, change use address localhost to the server’s LAN address or remove that line so Monit listens on every interface.

Monit’s built-in web interface can use TLS if you add with ssl { ... } options and PEM files to the set httpd block. For a simpler admin-only path, keep Monit on localhost and tunnel it over SSH. If you prefer HTTPS for shared admin access, put Monit behind a reverse proxy or enable Monit’s own SSL settings.

Test the file before restarting the daemon so Monit does not reload a broken configuration.

sudo monit -t
Control file syntax OK

Restart Monit so the HTTP listener and credentials take effect.

sudo systemctl restart monit

Now verify that Monit is really listening on port 2812. With the localhost-only example above, the listener stays local instead of opening the dashboard to the network.

ss -lnt | grep 2812
LISTEN 0      1024       127.0.0.1:2812      0.0.0.0:*
LISTEN 0      1024           [::1]:2812         [::]:*

Configure Firewall Rules for Monit on Ubuntu

You only need firewall rules for Monit if you changed the listener away from localhost and want another machine to reach port 2812 directly. If you kept the localhost-only configuration, skip this section and use the SSH tunnel in the next step instead.

UFW is common on Ubuntu desktops and servers, but it is not guaranteed on every minimal image. Install it first if the command is missing, or follow the full guide to configure UFW on Ubuntu if you want a broader firewall policy.

sudo apt install ufw

If you are connected over SSH, allow OpenSSH before enabling UFW so the firewall does not cut off your current session.

Add the SSH rule first when you manage the server remotely.

sudo ufw allow OpenSSH

Enable the firewall once SSH is allowed.

sudo ufw enable
Firewall is active and enabled on system startup

Allow the Monit dashboard from one trusted host if you only need a single admin workstation to reach it.

sudo ufw allow proto tcp from 203.0.113.50 to any port 2812

Use a subnet rule instead when multiple management systems on the same LAN need access.

sudo ufw allow proto tcp from 192.168.1.0/24 to any port 2812

Check the active ruleset so you can confirm that port 2812 is only open to the addresses you intended.

sudo ufw status numbered
Status: active

     To                         Action      From
     --                         ------      ----
[ 1] 22/tcp                     ALLOW IN    Anywhere
[ 2] 2812/tcp                   ALLOW IN    192.168.1.0/24
[ 3] 22/tcp (v6)                ALLOW IN    Anywhere (v6)

Access Monit Web Interface on Ubuntu

If you kept Monit bound to localhost, create an SSH tunnel from your workstation and browse the dashboard through the encrypted local endpoint. If SSH is not set up on the server yet, start with the guide to install SSH on Ubuntu.

ssh username@server-ip -L 2812:127.0.0.1:2812
http://127.0.0.1:2812

If you intentionally bound Monit to a server or LAN address and opened the firewall, use the server address instead. Monit’s web interface uses TCP port 2812 by default once the HTTP block is enabled.

http://203.0.113.10:2812

Log in with the credentials from /etc/monit/monitrc to reach the main dashboard and host summary.

Click the host entry to drill into CPU, memory, filesystem, and process data for the current machine.

The runtime page is also useful when you need to confirm poll intervals, uptime, and the active configuration state after a restart.

For deeper service checks, SSL options, alert routing, and dependency rules, consult the official Monit manual.

Troubleshoot Monit on Ubuntu

Most Monit problems on Ubuntu come from small syntax mistakes in monitrc, a missing HTTP listener, or firewall rules that do not match the address Monit is actually using.

Fix Monit Configuration Syntax Errors on Ubuntu

If Monit refuses to restart after you edit the control file, validate the syntax before changing anything else. A broken allow line or a missing quote is enough to stop the reload.

/etc/monit/monitrc:188: syntax error 'allow'
monit: error reading the control file '/etc/monit/monitrc'

Run the syntax test again after fixing the line. If Monit reports duplicate credentials such as Credentials for user admin were already added, keep only one allow user:password entry per user in the HTTP block.

sudo monit -t
Control file syntax OK

Restart the daemon only after the syntax check passes.

sudo systemctl restart monit

Fix Monit Web Interface Access Issues on Ubuntu

Start by checking whether Monit is active and whether anything is listening on port 2812. A running daemon with no 2812 listener usually means the set httpd block is still commented out or bound to a different address.

systemctl is-active monit
ss -lnt | grep 2812 || echo "port 2812 is not listening"
active
port 2812 is not listening

If the service is active but port 2812 is not listening, re-enable the HTTP block in /etc/monit/monitrc and restart Monit. If the listener exists but the browser still fails, recheck the bind address, firewall rule, and the username and password you saved in the control file.

Update or Remove Monit on Ubuntu

Ubuntu keeps Monit under normal APT package management, so ongoing maintenance is simple.

Update Monit on Ubuntu

Pull new package metadata and upgrade only Monit when you do not want to touch the rest of the system yet.

sudo apt update && sudo apt install --only-upgrade monit

Check the reported version afterward to confirm the new package is in place.

monit --version
This is Monit version 5.35.2
Built with ssl, with ipv6, with compression, with pam and with large files

Remove Monit from Ubuntu

Stop the service and purge the package if you want to remove Monit and its package-managed configuration files. Back up any custom checks, certificates, or alert scripts first if you stored them outside the default package paths.

sudo systemctl stop monit
sudo apt remove --purge monit

Clean up orphaned dependencies after the package is gone.

sudo apt autoremove

Refresh package metadata and verify that Monit is no longer installed.

sudo apt update
apt-cache policy monit
monit:
  Installed: (none)
  Candidate: 1:5.35.2-3
  Version table:
     1:5.35.2-3 500
        500 http://archive.ubuntu.com/ubuntu resolute/universe amd64 Packages

apt remove --purge clears the packaged Monit configuration under /etc/monit/, but it does not know about custom files you placed elsewhere. Delete any leftover TLS files, helper scripts, or exported backups manually after you confirm you no longer need them.

Monit on Ubuntu FAQ

What can Monit monitor on Ubuntu besides a running service?

Monit can watch more than whether a daemon is up. On Ubuntu it can also monitor process resource limits, ports, filesystems, files, directories, and network checks, then alert or restart a service when a rule fails.

Does Monit use systemd on Ubuntu?

Ubuntu 26.04 and 24.04 use a native systemd unit for monit.service. Ubuntu 22.04 still exposes Monit through a generated SysV wrapper, so systemctl status monit shows different loaded-path details even though the service still works with systemctl.

Why is port 2812 closed after I install Monit?

Monit does not open its web interface until you enable the set httpd block in monitrc and restart the daemon. After that, it listens on TCP port 2812 or on the specific address you configured.

Can Monit use TLS instead of plain HTTP?

Yes. Monit’s set httpd section supports with ssl options and PEM files for HTTPS. Many administrators still keep it bound to localhost and use SSH tunneling or a reverse proxy so the dashboard is not exposed directly.

Conclusion

Monit is running on Ubuntu with the daemon enabled, and the optional port 2812 dashboard is ready once the HTTP block matches the way you want to administer the server. If you want to put that dashboard behind a secure web stack, install Nginx on Ubuntu or install Apache on Ubuntu and reverse-proxy Monit with TLS.

Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffee Buy me a coffee

Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Leave a Comment

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: