Installing Squid

General Information

A quick guide to get a squid Proxy Server running under OpenBSD.

Requirements

Have a functioning OpenBSD installation. If you do, I assume you are somewhat familiar with the command line. I am using OpenBSD 4.2 currently, so if nothing else stops you, you should run the same.

Installation

On OpenBSD I try to adhere to the suggestion to only use packages to install software. Most of the things I ever needed are available as packages. Get the Package Directory from one of the CDs if you bought the set. If not, go to www.openbsd.com and get the package directory from one of the mirrors. Additionally, please read http://www.openbsd.org/faq/faq15.html#PkgMgmt so you are also able to install directly from one of their mirrors.
If you have all the packages required on your harddrive, then a simple:

pkg_add squid-2.6.STABLE13.tgz

will install the Squid Proxy Server.

Configuration

Configuration files are placed in /etc/squid. Edit /etc/squid/squid.conf and adjust whatever you need, specifically you should have the following entries:

http_port 3128
acl our_networks src 10.0.1.0/24 192.168.1.0/24 (change to your internal ip ranges)
http_access allow our_networks
cache_mem 32 MB (bumb it up if you have the RAM)
maximum_object_size 20480 KB (adjust)
cache_dir ufs /home/squid/cache 5000 16 256 (adjust the path)

That’s pretty much it. You should go through the complete well-documented configuration file and make any adjustments you need.
Save and close the file, make sure that the path you specified in cache_dir ufs /home/squid/cache does indeed exist. Also, change its permissions so they are owned by the _squid user and group.

chown -R _squid:_squid /path

Now it is time to create the cache directories. Simply run the following which will do the work for you.

squid -z

Following that, simply start squid by executing the command:

squid

Try and see if you can configure your browser settings to point to your proxy IP on port 3128 (or whatever you specified.)
Now if you want to have squid running at start up, place these lines into /etc/rc.local:

if [ -x /usr/local/sbin/squid ]; then
        echo -n ' squid';
        /usr/local/sbin/squid
fi

It will now start automatically on boot.

Conclusion

This was a very simple guide to setup Squid. Squid has a gazillion configuration options and can be modified to suit almost any need or requirement. Don’t stop now, keep reading the squid.conf file and make use of Google or else to find our more about Squid and how to tweak it to adjust it to your situation.

Speak Your Mind

*