Home > HowTo, Linux > SquidGuard 1.4 Howto

SquidGuard 1.4 Howto

February 6th, 2009 Leave a comment Go to comments

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: www.oracle.com/database/berkeley-db/index.html).
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 http://www.xoroz.com/files/db-4.6.21.tar.gz
# tar -zxvf http://www.xoroz.com/files/db-4.6.21.tar.gz
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/ld.so.conf
# ldconfig
Confirm its there
# ldconfig -v | grep libdb-4
(After updating, I erased he entry from ld.so.conf)

Now we can download and install SquidGuard
# wget http://www.squidguard.org/Downloads/squidGuard-1.4.tar.gz
# 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

ScreenShot http://www.niemueller.de/webmin/modules/squidguard/screenshots/mainpage.jpg

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

More http://www.squidguard.org/Doc/configure.html
More http://www.maynidea.com/squidguard/faq-plus.html

Helpe Me out with just one simple click:


  1. Anton Ermakov
    March 24th, 2009 at 12:21 | #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. xoroz
    March 24th, 2009 at 12:30 | #2

    THanks Anton, i fixed that line.

  3. April 9th, 2009 at 16:57 | #3

    thank you for you effort

    a up todate clear guide

  4. Abraham
    May 19th, 2009 at 00:45 | #4

    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/ld.so.conf[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
    libdb-4.6.so -> libdb-4.6.so
    libdb-4.7.so -> libdb-4.7.so
    [root@localhost midi_squid]# cd /usr/local/BerkeleyDB/lib
    [root@localhost lib]# ls
    libdb-4.6.a libdb-4.6.la libdb-4.6.so* libdb-4.so@ libdb.a libdb.so@
    [root@localhost lib]

    Could you help me please?
    Thank you.

  5. Abraham
    May 21st, 2009 at 16:13 | #6

    Thank you Felipe. I’ll try another things-

  6. Ramesh
    November 13th, 2009 at 23:59 | #7

    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 http://www.oracle.com
    use –with-db=DIR or –with-db-inc=DIR,
    –with-db-lib=DIR to specify its location
    (default is /usr/local/BerkeleyDB)


  7. Renatux
    January 7th, 2010 at 10:26 | #8

    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


  8. Beth22
    September 25th, 2010 at 06:11 | #9

    compile new BerkeleyDB or recreate shortcut to lib file.


  9. mIRO
    March 9th, 2011 at 11:11 | #10

    “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… 🙁

  10. alextv
    May 12th, 2011 at 22:38 | #11


    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

  11. umair
    November 21st, 2011 at 17:10 | #12

    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

  12. Yosef
    March 6th, 2013 at 07:13 | #13

    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,

  13. Ree
    August 20th, 2013 at 03:55 | #14

    I am not really computer savvy. I have never downloaded squidguard. How do I remove this from my computer? I can be emailed at renitamac@yahoo.com

  14. January 10th, 2014 at 06:50 | #15

    I have found the installation problem of squid guard,
    I followed the tutorial and fixed it, the issue was the environmental variable of BerkelyDB


    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

  1. March 1st, 2009 at 08:10 | #1
  2. March 3rd, 2011 at 05:35 | #2