Monitoring Linux Mail Server with Lightmeter (Debian, Ubuntu)
12:47, 27.08.2026
In this article, we will share our practical experience according to the usage of the Lightmeter. This server monitoring tool can be extremely beneficial for a variety of users who need to monitor server activity with an open-source solution. So, let’s dive deeper into this topic!
Key Benefits of Using Lightmeter
- Monitoring of RBL or Real-time Block lists
- Extremely user-friendly interface
- The support of the remote as well as local logfiles
- Monitoring of the mail server downtime
- Additional protection if you need to deal with brute-force or Botnet risks
- Identification of the blocked emails by other types of SMTP servers
What You Need to Get Started
To start the installation process of Lightmeter, you should already have a running mail server. In case, you don’t, there are a diversity of tutorials that you can use for the quick setup either on your Debian or Ubuntu system.
Step 1: Installing the Lightmeter Binary: Quick Guide
Start with entering your server via SSH. After that with the help of the following line download the latest version of this open-source solution:
wget https://gitlab.com/api/v4/projects/17017123/packages/generic/lightmeter/1.9.1/lightmeter-linux_amd64-1.9.1
Once you have done the initial step, you need to move it to the following directory:
sudo mv lightmeter-linux_amd64-1.9.1 /usr/local/bin/lightmeter
With the next steps, you should add a user and run Lightmeter:
sudo useradd lightmeter --create-home --home-dir /var/lib/lightmeter_workspace –system
sudo -u lightmeter /usr/local/bin/lightmeter -watch_dir /var/log
After the completion of all the above-discuss steps, you can enter the interface of Lightmeter with:
http://your-server-ip:8080
Here, you will be welcomed with a window where you should create an admin account.
Step 2: Setting Up a Systemd Service for Lightmeter
For the stoppage of all the processes connected with Lightmeter use Ctrl+C. After that create a unit with the following line:
sudo nano /etc/systemd/system/lightmeter.service
The following info should be added to the file:
[Unit]
Description=Mail Server Monitoring
After=network.target
[Service]
Type=simple
ExecStartPre=/bin/bash -c '/usr/bin/setfacl -R -m u:lightmeter:rx /var/log/mail*'
ExecStart=sudo -u lightmeter usr/local/bin/lightmeter -watch_dir /var/log/
ExecStop=sudo -u lightmeter /usr/bin/pkill /usr/local/bin/lightmeter
Restart=always
SyslogIdentifier=Lightmeter
[Install]
WantedBy=multi-user.target
After adding the needed details, it is required to save the file and reload systemd, start Lightmeter, and enable the automagical start with the following lines:
sudo systemctl daemon-reload
sudo systemctl start lightmeter.service
sudo systemctl enable lightmeter.service
In case, everything is done correctly you should check the status and get the output with active status, process description, tasks, main PID info, and more. To check its status use:
sudo systemctl status lightmeter.service
Step 3: Configuring a Reverse Proxy for Seamless Operations
For accessing Lightmeter with the web interface, it is crucial to set up a proper process with Nginx or Apache. Thanks to our practical knowledge in this process, we decided to share all the little details for you.
Reverse Proxy with Nginx
In case you decide to use Nginx for the reverse proxy, you should use the following command for the installation:
sudo apt install nginx
Once that is done, the following step is the creation of the block file with such line:
sudo nano /etc/nginx/conf.d/lightmeter.conf
After the creation of the file, the following information should be added:
server {
listen 80;
listen [::]:80;
server_name skill.com; (skill.com – should be changed on the real DNS name)
access_log /var/log/nginx/lightmeter.access;
error_log /var/log/nginx/lightmeter.error;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}
}
Once the details are added save the file with the changes made, test the configuration, and reload Nginx with:
sudo nginx -t
sudo systemctl reload nginx
Setting Up Apache as Your Reverse Proxy
In case, you would rather use Apache, here is a short instruction about the setting up process using Apache. Start with the following command:
sudo apt install apache2
To use it as a reverse proxy, there is a necessity to make some changes such as:
sudo a2enmod proxy proxy_http headers proxy_wstunnel
Then host file should be created with:
sudo nano /etc/apache2/sites-available/lightmeter.conf
Once the file is created, the following info should be added:
<VirtualHost *:80>
ServerName skills.com (skills.com – needs to be replaced with the real name)
ErrorDocument 404 /404.html
#HTTP proxy
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
After that save the changes, and restart the system. If everything has been done properly, you can access the media server with no issues.
Step 4: Enabling HTTPS for a Secure Setup
For the secure setup, it is crucial to enable HTTPS from Let’s Encrypt. To run this free certificate on Ubuntu use:
sudo apt install certbot
For the Nginx users the steps are the following:
sudo apt install python3-certbot-nginx
sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email your@example.address.com -d lightmeter.yourexample.com
For Apache users the process is similar:
sudo apt install python3-certbot-apache
sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email you@realexample.com -d lightmeter.your.example.com
Step 5: Fine-Tuning Lightmeter Settings
In case, everything was done properly, you can enter the web interface and create an admin account. After Lightmeter entering, you will immediately access the overview webpage. Then you can go further and enable necessary notifications.
Mail Flow Issues with Message Detective
Also, you can check the delivery status of all the emails with the magnifier. From the settings, you can switch on the public access of the message detective webpage.
Conclusion
Hope this short guide was helpful in case you are planning to monitor a Linux mail server with Lightmeter.