From Fedora Project Wiki

Introduction

Squid is a caching proxy. Its purpose it to speed up repeated access to Internet resources by caching data and then providing them to its clients using a fast LAN instead of slower Internet access. In AutoQA we after download a lot of large files (RPM packages, ISO images, etc). Several tests may need the same data. When developing the test, we may need to run the same test (using the same data) over and over again. You can considerably speed up test execution time by keeping the files locally (on the proxy) instead of re-downloading them from web server all the time. This guide will help you install Squid proxy and configure it for AutoQA use.

This guide supposes you already have AutoQA installed.

Install and configure Squid

  1. Install Squid proxy:
    # yum install squid
  2. Edit /etc/squid/squid.conf
    • Uncomment cache_dir directive and set the allowed max size of the cache dir. Example:
      cache_dir ufs /var/spool/squid 20000 16 256
      sets the max cache dir size to 20 GB.
    • Add maximum_object_size directive and set its value to the largest file size you want to cache. Example:
      maximum_object_size 5 GB
      allows to cache DVD-sized files.
    • Optional: Disable caching from some domains. If you have some files/mirrors already on your local network and you don't want to cache those files (the access is already fast enough), you can specify it using acl and cache directives. This example disables caching of all traffic coming from .redhat.com domain:
      acl redhat dstdomain .redhat.com
      cache deny redhat
      
  3. Start Squid service:
    # service squid start
  4. Enable Squid service on boot:
    # chkconfig squid on
  5. Make sure iptables or SELinux do not block Squid operating on port 3128 (the default value).

Test Squid

Confirm that Squid is working by executing following commands from localhost and a remote machine:

$ export http_proxy=http://your_proxy:3128
$ wget http://server/file
$ wget http://server/file

Wget output should indicate that it has connected to your proxy. The second request for the same file should be much faster. (Note: https requests can't be cached.)

The cache dir size should be growing with every new request. Confirm by:

$ du -sh /var/spool/squid

You should see all the proxy requests by inspecting the log /var/log/squid/access.log.

Configure AutoQA

We will now set your Squid proxy as the default proxy for all requests on your test clients:

  1. On your server with AutoQA installed edit /etc/autoqa/autoqa.conf
  2. Set http_proxy variable:
    http_proxy = http://your_proxy:3128

All your future test runs should download files using this proxy (you can confirm that by inspecting the proxy log).