Howto setup SquidGuard 1.4
(check out my howto on SQUID)
* Bison
* Flex
* Berkeley DB V.2.7.7, V3.2.x or 4.x (original site:
Annotation: Berkeley DB version 4.7 gives error messages during compilation. Up to version 4.6 the compilation runs fine.
* A C compiler like GCC
Lets start it:
# apt-get install bison flex
We also need the berkeley-db (recommend is version 4.6)
# wget
# tar -zxvf
cd db-46..
cd build_unix
../dist/configure –prefix /usr/local/BerkeleyDB
This will build the Berkeley DB library.
# make
To install the Berkeley DB library, enter the following command:
# make install
Update our library (debian)
# echo “/usr/local/BerkeleyDB/lib” >> /etc/
# ldconfig
Confirm its there
# ldconfig -v | grep libdb-4
(After updating, I erased he entry from
Now we can download and install SquidGuard
# wget
# tar -zxvf squidGuard-1.4.tar.gz
# cd squidGuard-1.4
# ./configure --with-squiduser=proxy (bu default it is: squid)
# make
# make install


“Installing squidGuard
Installing configuration file
Created directory /usr/local/squidGuard/db
Assigned /usr/local/squidGuard/db to user proxy
Created directory /usr/local/squidGuard/log
Assigned /usr/local/squidGuard/log to user proxy
Copied sample squidGuard.conf
/usr/local/squidGuard/squidGuard.conf is now readable
The initial configuration is complete.
Congratulation. SquidGuard is sucessfully installed.”

Very important once you finish make sure you have this line in squid.conf:
redirect_program /usr/local/bin/squidGuard -c /usr/local/squidGuard/squidGuard.c
like: redirect_program /squidGuard -c /squidguard.conf
Start squidGuard (will show output to stdout, also check .log for any errors):
# squidGuard -d
Install the Module into Webmin:
> Webmin > Webmin Configuration > Webmin Module > from Ftp or URl

Download the blists and put the text version into the /db folder
Then Initiale the blacklists (convert text to .db)
# chown -R /usr/local/squidGuard/db/*
# squidGuard -C all

To rebuild Berkeley DB, enter:
# make clean
# make
If you change your mind about how Berkeley DB is to be configured, you must start from scratch by entering the following command:
# make realclean
# make
To uninstall Berkeley DB, enter:
# make uninstall
Installing the blacklists
Copy your blacklists into the desired blacklist directory (default: /usr/local/squidGuard/db) and unpack them. In the table below we assume that the default location is used. Make sure that you have the proper permissions to write to that directory.
# cp /path/to/your/blacklist.tar.gz /usr/local/squidGuard/db
# cd /usr/local/squidGuard/db
# gzip -d blacklist.tar.gz
# tar xfv blacklist.tar
Thru the webmin interface it is really easy to do most of the configuration
Config File Basic

dbhome /usr/local/squidGuard/db
logdir /usr/local/squidGuard/logs
dest porn {
domainlist porn/domains
urllist porn/urls
acl {
default {
pass !porn all
redirect http://localhost/block.html


Helpe Me out with just one simple click:


Tags: , , , , , , , , , , , , ,

17 thoughts on “SquidGuard 1.4 Howto

  1. You have an error is in the line:
    ../dist/configure –prefix /usr/local/BerkleyDB
    The right variant is:
    ../dist/configure –prefix /usr/local/BerkeleyDB

  2. Hi Felipe, actually Iam runnig squid/3.0 STABLE14, all its OK, but with squidGuard I have the problem compiling BerkeleyDB.
    I followed this tutorial, for the setup of Berkeley DB (4.6), but squidGuard1.4 dont compiles all the db’s.
    Squid and SquidGuard are running over Mandriva Free 2009.1
    [root@localhost midi_squid]# echo “/usr/local/BerkeleyDB/lib” >> /etc/[root@localhost midi_squid]# ldconfig
    [root@localhost midi_squid]# ldconfig -v | grep libdb-4
    ldconfig: Can’t stat “/usr/local/BerkeleyDB/lib”: No such file or directory
    ldconfig: Can’t stat “/usr/local/BerkeleyDB/lib”: No such file or directory
    ldconfig: Can’t stat “/usr/local/BerkeleyDB/lib”: No such file or directory -> ->
    [root@localhost midi_squid]# cd /usr/local/BerkeleyDB/lib
    [root@localhost lib]# ls
    libdb-4.6.a* libdb.a
    [root@localhost lib]
    Could you help me please?
    Thank you.

  3. I followed the steps and I got the following error while running ./configure for squidguard installation.
    ** The Berkley DB library version 2.6.4 or newer
    is required. Get it from
    use –with-db=DIR or –with-db-inc=DIR,
    –with-db-lib=DIR to specify its location
    (default is /usr/local/BerkeleyDB)

  4. @Abraham
    Hi Abraham !
    You can compiling changing the:
    *XXX is the version of BerkeleyDB
    You can just compiling only changing the /lib on the end of BerkeleyDB dir

  5. Pingback:
  6. “Very important once you finish make sure you have this line in squid.conf:
    redirect_program /usr/local/bin/squidGuard -c /usr/local/squidGuard/squidGuard.conf”
    Actually, this works for Squid versions 2.5 and below, but not for 2.6 and abobe…you should use “url_rewrite_program” instead of redirect_program.
    And then there is a problem with SquidGuard Webmin module…if there is no redirect_program line in squid.conf he reports that “Squid not configured”and adds “redirect_program…” line in squid.conf… 🙁

  7. mIRO
    I had the same problem. As you said, this works for squid versions 2.5 and below. Thats why squidguard webmin module is tries to find the line redirect_program, and it says squid is not configured to use squidguard as a redirector.
    I think I have a workaround for this problem. You shoul change some cgi files that Squidguard module uses to check and change squid configuration.
    first, look for arm_squid.cgi, index.cgi and index2.cgi files. They should be in /usr/share/webmin/squidguard or /usr/libexec/webmin/squidguard directory, depending the distribution you’re using.
    inside arm_squid.cgi look for the lines:
    local $dir = { ‘name’ => ‘redirect_program’, ‘values’ => [ $squidguard_command ] };
    &foreign_call(‘squid’, ‘save_directive’, $squidconf, ‘redirect_program’, [ $dir ]);
    change redirect_program for url_rewrite_program
    inside index.cgi and index2.cgi llok for the lines:
    my $directive = &foreign_call(‘squid’, ‘find_config’, ‘redirect_program’, $squidconf);
    change redirect_program for url_rewrite_program
    With these changes squidguard module for webmin should work fine
    Hope this can help you
    Best regards,
    P.D: Sorry for bad english

  8. alex i need more help about squidguard i had configured squid on redhat linux it work fine when i install squid guard it run,but when i change squidguards.conf file squid stop

  9. Hello.
    I am junior system administrator. Currently I am working on squid proxy and squid guard. Because I did not have experience with opensuse platform, It became difficult for me.
    So I hope it will be easy for me in the next (squid and Squid guard).
    Just you can share me any thing important to me.
    Best Regards,

  10. I have found the installation problem of squid guard,
    I followed the tutorial and fixed it, the issue was the environmental variable of BerkelyDB!topic/comp.unix.solaris/8Q-nhszThY4
    run configure with appropriate environment parameters, i.e.
    LDFLAGS=’-R/usr/local/BerkeleyDB/lib’ ./configure …
    or with
    export LD_RUN_PATH=/usr/local/BerkeleyDB/lib
    ./configure …
    make …
    The run path has always to be set explicitly for the configure
    Basit Khan

Leave a Reply

Your email address will not be published. Required fields are marked *