Installing Squid

Installing squid binary package can differ from one linux distro to another. Red-hat based distro can use package manager such as rpm to install squid, while debian based distro usually uses apt package manager. Alternatively, squid can always be compiled and installed from the its source files (you can download the source files from http://www.squid-cache.org). In this sub chapter, we will explore two ways to install squid, that are using rpm and compiling from source files.

A. RPM

For example, the squid's binary package name is squid-2.6.STABLE17.i386.rpm, then the step to install the binary rpm of squid are:

1. Make sure that squid is already installed. Open a terminal and login as root and type following command:
rpm -q squid
Notice the message appears on screen. If squid is already install, then the version of squid will appear
2. If squid has not been installed yet, then do the following command to install:
rpm - ivh squid-2.6.STABLE17.i386.rpm
3. After installation, make sure that the installation is successful by :
rpm -q squid
After installation, you can proceed to configure squid (next section)
4. In case you need to uninstall squid, do following command:
rpm -e squid-2.6.STABLE17
userdel squid

B. Compile from source files

To be able to compile from source files, make source all development library installed on the machine (compiler and libararies). Before doing the installation, download the source files from squid official sites (http://www.squid-cache.org) and then do following steps:

1. Open a terminal and login as root, copy the source files to a directory such as /usr/src and then extract the source files.

if the source files are in gzip format, do following command

tar -xvfz squid-2.6.STABLE17.tar.gz

if the source files are in bzip2 format, do following command

tar -xvfj squid-2.6.STABLE17.tar.gz

2. Change directory to extracted squid source files

cd /usr/src/squid-2.6.STABLE17

3. compile the source files (the prefix parameter tells the compiler where to install squid)and install squid with these three following commands

./configure --prefix=/usr/local/squid
make all
make install

4. In order to run squid, we need to create a new user and group with following commands:

useradd squid

5. Change to installed directory :

cd /usr/local/squid
6. change the owner and group of the directory /usr/local/squid/var from root to group root to user squid and group squid :
chown -R squid.squid /var

The installation finishes here, and can be proceeded to configuration section

7. If you need to uninstall squid, do following commands:

cd /usr/src/squid-2.6.STABLE17
make uninstall
rm -rf /usr/local/squid
userdel -r squid