AVG Antivirus For Linux/FreeBSD Plus Qmail Mail Server

This document describes how to deploy AVG Antivirus for Linux/FreeBSD to the Qmail mail server.
It is usable for AVG version 8.5, 10 and 2012.



1) Linux or FreeBSD x86 or x86_64 with x32 compatible libraries. (See /opt/avg/av/doc/README.)
2) Configured Postfix Mail server.
3) Correct HW configuration for AVG:

  • CPU: i686 or amd64 on 800 MHz
  • Mem: 512 MB, 1GB is recommended
  • HDD: 500 MB of free space



1) Download correct package from AVG site:

Trial: http://www.avg.com/cz-cs/download.prd-trialb
Free: http://free.avg.com/cz-cs/stahnout.tpl-stdfull.prd-alf

NOTE: Trial/full package contains Antispam module. Later migration from free to full is possible.

2) Install package according to your distribution. Examples:

Installation from RPM (Linux only):

# rpm -i avg2012lms-r{release}-a{vdb version}.{architecture}.rpmif(typeof __ez_fad_position != ‘undefined’){__ez_fad_position(‘div-gpt-ad-howtoforge_com-medrectangle-4-0’)};if(typeof __ez_fad_position != ‘undefined’){__ez_fad_position(‘div-gpt-ad-howtoforge_com-medrectangle-4-0_1’)}; .medrectangle-4-multi-108{border:none !important;display:block !important;float:none;line-height:0px;margin-bottom:15px !important;margin-left:0px !important;margin-right:0px !important;margin-top:15px !important;min-height:250px;min-width:250px;text-align:center !important;}

Installation from .deb (Linux only):

# dpkg -i avg2012lms-r{release}-a{vdb version}.{architecture}.deb

Installation from sh (Linux only):

# chmod +x avg2012lms-r{release}-a{vdb version}.{architecture}.sh
# ./avg2012lms-r{release}-a{vdb version}.{architecture}.sh

Installation from .tar.gz:if(typeof __ez_fad_position != ‘undefined’){__ez_fad_position(‘div-gpt-ad-howtoforge_com-box-4-0’)};

# tar xzvf avg2012{edition}-r{release}-a{vdb version}.{architecture}.tar.gz
# cd avg2012{edition}-r{release}-a{vdb version}.{architecture}
# ./install.sh



You can register AVG for Linux/FreeBSD during installation from sh or tar.gz,
or later using command:

# avgctl –register ‘your license number’

NOTE: Free version is registered automatically during instalation, trial license is available at /opt/avg/av/doc/README.


Start of AVG Anti-Virus

It is possible to use init scripts or avgctl utility:


# /etc/init.d/avgd start


# /usr/local/etc/rc.d/avgd.sh startAdvertisement.large-leaderboard-2{text-align:center; padding-top:10px !important;padding-bottom:10px !important;padding-left:0px !important;padding-right:0px !important;width:100% !important;box-sizing:border-box !important;background-color:#eeeeee !important;border: 1px solid #dfdfdf}if(typeof __ez_fad_position != ‘undefined’){__ez_fad_position(‘div-gpt-ad-howtoforge_com-large-leaderboard-2-0’)};

Both systems:

# avgctl –start


Integration AVG to Qmail – Qmail Queue

Integration is possible via Qmail Queue AVG module.
Qmail Queue for AVG is a module included into the Qmail email process
chain. It allows to scan incoming and outgoing email messages for
viruses and spam. It replaces the original qmail-queue file
with the qmail-queue-avg file which implements communication with
the AVG Daemon. After email scanning the original qmail-queue is
executed. Note that execution of the original qmail-queue depends
on the AVG Daemon settings. For example when a email contains a virus
and the AVG Daemon is configured to drop email with virus the
original qmail-queue will not be executed.

* Original email process chain:

qmail-inject —
                —> qmail-qmail —> qmail-send —> …
qmail-smtpd  —

* Email process chain with the Qmail Queue for the AVG Daemon:

                       AVG Daemon
                          ^ |
qmail-inject —          | |
                |         | |
                v         | v
                —> qmail-qmail-avg —> qmail-queue  —> qmail-send —> …
qmail-smtpd  —


Installation of Qmail Queue AVG

Download Qmail Queue AVG source from here.
Advertisement.leader-1{text-align:center; padding-top:10px !important;padding-bottom:10px !important;padding-left:0px !important;padding-right:0px !important;width:100% !important;box-sizing:border-box !important;background-color:#eeeeee !important;border: 1px solid #dfdfdf}if(typeof __ez_fad_position != ‘undefined’){__ez_fad_position(‘div-gpt-ad-howtoforge_com-leader-1-0’)};

For example:

wget http://download.avg.com/filedir/inst/qmail-queue-avg.tar.gz

Unpack archive and go to the folder:

tar xzvf qmail-queue-avg.tar.gz && cd qmail-queue-avg

Edit configure file:

Change/leave binary path of qmail-queue file:


Change/leave path of symbolic link to qmail-queue file:


Note: Symlink is automaticaly created via installation process if it is not available.

Change/leave path of new qmail-queue-avg file:


Note: You can also set this parameter with configure command. See help of configure for details.

Run trinity:

make install

Integration AVG to Qmail is done now. Restart of mail server is not needed.


AVG Service Configuration

Configuration is out-of-the-box, it works at all after integration.

If you need to change some specific parameters use utility avgcfgctl.

For example if you need write configuration use:

avgcfgctl -w ‘parameter=value’

For more details see man page of avgcfgctl.


Specific configuration for QMail (AVG protocol).

It is needed to set some parameters:

Enable AVG protocol:


Define port:


Make sure this port is the same as port defined in configure file of Qmail Queue AVG module.


Other useful AVG parameters:

For settings:


This item enables/disables whole E-Mail functions.


Enable/disable Anti-spam function.

For scanning:


It defines level of processing archive files.Values:

  • 0 – no archives, macros, cookies, real-time compression will be scanned, including MIME
  • 32 – only macros, cookies, real-time compression will be scanned
  • 256 – archives, macros, cookies will be scanned


This enables/disables detection of cookies.


This enables/disables detection of Potentially Unwanted Programs.


Use heuristic during scan.


This item defines maximal size of extracted archive.


This item defines maximal count of extracted files.


Maximal level of recursion for archive.


Enable detection of defined attachments.

For basic Anti-spam configuration:


This item adds “AVG Anti-spam header” to mail.


This item adds prefix to subject – mail with phishing.


This item sets score for Spam identification (less means more spam).


This item adds prefix to subject – mail with spam.

Other actions:


It enables/disables AVG certification in body of E-mail.


This items defines action for each detected message. Values:

  • 0 – PASS means message will be only certified (header, subject, body,..)
  • 1 – DROP means message will be deleted
  • 2 – BOUNCE means message will be delivered to adress defined by parameter Default.tcpd.rules.*.bounce_addr


There is defined adress for BOUNCE action.


This parameter adds “AVG Anti-virus header” to mail.


This item adds prefix to subject – mail with virus.

Basic statistics of scanned messages:

For basic statistic enter command:

avgctl –stat=tcpd

This returns (depends on settings):

AVG command line controller
Copyright (c) 2012 AVG Technologies CZ

—— Tcpd status ——
E-mails checked : 10256
SPAM messages : 104
Phishing messages : 2
E-mails infected : 211
E-mails dropped : 211

Operation successful.

NOTE: For other parameters see avgtcpd and avgspamd man page! After configuration restart all related services (AVG).

About the Author

Leave a Reply