Server Administration
  Home arrow Server Administration arrow Page 2 - Installing and Configuring Squid
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
SERVER ADMINISTRATION

Installing and Configuring Squid
By: Barzan 'Tony' Antal
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-07-01

    Table of Contents:
  • Installing and Configuring Squid
  • Get it Up and Running!
  • More, More... Configuration!
  • Final Thoughts

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Installing and Configuring Squid - Get it Up and Running!


    (Page 2 of 4 )

    As always with software, the first step is downloading the release package. You can read important information regarding the several ways to obtain Squid from this page. Technically, Squid already comes in numerous distribution packages or can be acquired via their ports/package systems (by downloading). If not, you can opt for downloading the source code and compiling it yourself or just going with the binary package.

    For the purpose of this article we're installing Squid on a test Linux machine that runs the Gentoo Linux distribution. One of the specific traits of this distro is that it heavily relies on a so-called Portage system. Portage is package management software. And under Gentoo you can grab ebuilds for over 25,000 applications. Of course, Squid is available in Portage too. So the following two commands are Gentoo-specific:

    emerge --sync

    emerge squid

    Executing the above two commands first sync the Portage system and then grab and install Squid. Pay close attention to the outcome of the process. Everything is printed to the console output. Now we need to create the cache directory for Squid. We will do this into the /mnt folder, for example. All right, we still need to configure the user squid with the necessary permissions for that newly-created directory.

    mkdir /mnt/cache

    chown -R squid:squid /mnt/cache

    In most cases, Squid is installed under the /usr/local/squid directory. The official documentation advises mounting the cache under /usr/local/squid/cache but we can do this anywhere else too, just as we've done above. This is not a requirement.

    The official guide (which is composed of excerpts of the book) also recommends setting up a user squid and a group squid, with the home directory of /usr/local/squid. Should you allow more users access to the configuration files, you should set the permissions accordingly. It's going to run as a daemon under the user nobody and group nogroup, as every other daemon. But we'll alter this later on.

    Now that we have done the majority of installation steps, we still have to configure. You can find the squid.conf configuration file under the /usr/local/squid/etc folder. We need to modify that file according to our specific requirements. First of all, let's discuss each command line by line. This approach is more understandable than copying and pasting the entire configuration file and then explaining. We will present just the bare minimum!

    By default, Squid runs on the 3128 port. This port is widely known because Squid runs under this port by default, unlike other proxies, which run under 8080. However, this can be modified, if need be. You should choose a port number higher than 1024, because those are part of the "untrusted" ports and do not require administrative access.

    http_port 192.168.1.1:8080

    Moving on, let's define the host name of the Squid caching proxy server.

    visible_hostname proxy_srv

    All right, now let's speed up the process and set the caching directory that we just created earlier. This is when we also need to specify the maximum size of the cache. Right now we'll create a ~10GB cache. Mind you, the exact size will be 10,000MB. Once that's done, we also want to modify the user and group under which Squid should run.

    # we created the /mnt/cache earlier

    cache_dir ufs /mnt/cache 10000 16 256

    # now comes the user/group part

    cache_effective_user squid

    cache_effective_group squid

    On the next page we will configure the necessary ACLs-access control lists, among other specifics such as allowing only our LAN users and the logging place.

    More Server Administration Articles
    More By Barzan 'Tony' Antal


     

    SERVER ADMINISTRATION ARTICLES

    - Processes in the UNIX Shell
    - Migrating from Windows to Wine
    - Wine: Not Another Emulator
    - Preventive Measures to Block SSH Attacks
    - Monitoring Temperatures with Cacti
    - Cacti: RRDTool-based Graphing Solution
    - Network Magic 5.0 Review
    - Netfilter and Iptables Overview
    - Installing and Configuring Squid
    - Clickfree PC Backup Systems Compared
    - Squid, the Caching Proxy
    - Regular Expressions in the Unix Shell
    - Source Code Version Control Solutions
    - OTRS: Open Source Ticket Request System
    - Clonezilla: Free Mass Disk-Cloning Utility





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek