Reply to comment

Install and configure Squid in Slackware64 13.37

This is a guide on how to create Slackware Squid package using scripts from Slackbuilds.org, install it in Slackware64 13.37 and configure the squid.conf configuration file. It is just a basic configuration to get Squid cache proxy server works. Advanced setting is not included. You should read and at least understand some basic of Squid before try this step by step guide. Here is Squid-cache website. Before we begin, please make sure you have these basic requirements:

  1. Two network interface cards.
  2. Setup dhcp server.

The ip address must be set and working. For example, the first network card, eth0 is set and connected to the router. The second network card, eth1 is set and connected to the local network's switch. Here is a tutorial on how to configure network card in Slackware Linux basic network configuration. After that, setup dhcp server and make Slackware a gateway. Here is a guide on how to setup a dhcp server in Slackware, Install and configure dhcp server in Slackware Linux. When all clear, you can begin Squid cache proxy server configuration.

This tutorial consists of several steps. Basically, here's what we are going to do:

  • Create Squid package for Slackware64 13.37
  • Install Squid package in Slackware64 13.37
  • Configure Squid cache proxy server in Slackware64 13.37
  • Start Squid daemon in Slackware

Create Squid package for Slackware64 13.37

1) Download necessary files from SlackBuilds.org.

2) Change directory to your working area and extract Squid slackbuilds script file. See example below:

[email protected]:~# cd slackware/source/myslackware/
[email protected]:~/slackware/source/myslackware# tar zxvf /home/jinlusuh/squid/squid.tar.gz
squid/
squid/squid.logrotate
squid/README
squid/doinst.sh
squid/squid.conf
squid/squid.info
squid/slack-desc
squid/README.SBo
squid/squid.SlackBuild
squid/squid.conf.documented
squid/rc.squid
[email protected]:~/slackware/source/myslackware# 

3) Change directory to the "squid" directory from the slackbuild's script file that we've just extracted. Copy squid source, 'squid-3.1.12.tar.bz2' into the directory. See step by step command below

[email protected]:~/slackware/source/myslackware# cd squid/
[email protected]:~/slackware/source/myslackware/squid# cp /home/jinlusuh/squid/squid-3.1.12.tar.bz2 .
[email protected]:~/slackware/source/myslackware/squid#

4) Run libmcrypt.SlackBuild script to begin create Slackware Squid package:

[email protected]:~/slackware/source/myslackware/squid# ./squid.SlackBuild 

5) When the process is over, you can find the Slackware Squid package result in the /tmp directory (default slackbuild configuration). Now change directory to the /tmp and copy the Squid package for backup. See step by step example below:

[email protected]:~/slackware/source/myslackware/squid# cd /tmp/
[email protected]:/tmp# cp squid-3.1.12-x86_64-1_SBo.tgz ~/slackware/packages/

Install Squid package in Slackware

Now that the Squid package is ready, let's install it using Slackware 'installpkg' tool. Below is the example on how to install Squid package in Slackware:

[email protected]:/tmp# installpkg squid-3.1.12-x86_64-1_SBo.tgz 
Verifying package squid-3.1.12-x86_64-1_SBo.tgz.
Installing package squid-3.1.12-x86_64-1_SBo.tgz:
PACKAGE DESCRIPTION:
# Squid (a popular free and open source Web proxy server and web cache)
#
# Squid is a high-performance proxy caching server for web clients,
# supporting FTP, gopher, and HTTP data objects. 
#
# Homepage: http://www.squid-cache.org/
#
Executing install script for squid-3.1.12-x86_64-1_SBo.tgz.
Package squid-3.1.12-x86_64-1_SBo.tgz installed.

[email protected]:/tmp# 

Configure Squid cache proxy server in Slackware 13.37

We are ready to configure Squid in Slackware as a cache proxy server. Change the directory /etc/squid. This is the home of Squid configuration files.

[email protected]:/tmp# cd /etc/squid/
[email protected]:/etc/squid# ls
cachemgr.conf          errorpage.css.default  squid.conf
cachemgr.conf.default  mime.conf              squid.conf.default
errorpage.css          mime.conf.default      squid.conf.documented
[email protected]:/etc/squid# 

You can start configure squid by editing the squid configuration file which is the /etc/squid/squid.conf file.

[email protected]:~# vim /etc/squid/squid.conf

Scroll down to the 'Recommended minimum configuration' or you can type '/Recommended minimum configuration' and press Enter. See example below:

# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
#acl localnet src 10.0.0.0/8    # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16        # RFC1918 possible internal network
#acl localnet src fc00::/7       # RFC 4193 local private network range
#acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
acl localnet src 192.168.1.0/255.255.255.0      # Makmal Bahasa  internal network

acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT

The red color font is a local network that we add to the proxy server. Next, we are going to set the http port for the proxy. So scroll down again until you found http_port as in the example below:

# Squid normally listens to port 3128
#http_port 3128
#http_port 192.168.1.1:8080
http_port 8080

You can use the default port if you want. When you are done, we can set the cache directory size now. Scroll down and find 'cache_dir' as in the example below. The format is "cache_dir ufs Directory-Name Mbytes L1 L2 [options]" where L1 is level one subdirectory size and L2 is level 2 subdirectory size.

#Default:
cache_dir ufs /var/cache/squid/ 5000 16 256

That's the basic setting to get cache proxy server to works. The rest is up to you.

Start Squid daemon in Slackware

What you need to do now is to start Squid daemon. So you have to make the rc.squid file executable and the restart the service. Below is the steps example:

[email protected]:~# chmod 755 /etc/rc.d/rc.squid 
[email protected]:~# /etc/rc.d/rc.squid restart
Shutting down Squid in 30 seconds:  
Creating swap directories:  /usr/sbin/squid -z
Starting Squid:  /usr/sbin/squid -F
2011/06/12 15:05:19| WARNING: Netmasks are deprecated. Please use CIDR masks instead.
2011/06/12 15:05:19| WARNING: IPv4 netmasks are particularly nasty when used to compare IPv6 to IPv4 ranges.
2011/06/12 15:05:19| WARNING: For now we will assume you meant to write /24

Oh there are warnings. Open Squid configuration file again and edit the rules. See example below:

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
#acl localnet src 10.0.0.0/8    # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16        # RFC1918 possible internal network
#acl localnet src fc00::/7       # RFC 4193 local private network range
#acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
acl localnet src 192.168.1.0/24        # Makmal Bahasa  internal network

That's it for now. Don't forget to restart daemon after you modify the configuration file. There are three daemons related in this task which are squid daemon, inet1 (network card) and dhcpd. We are going to set on the client side now. See step by step guide below on how to do it.

Setup client to use squid cache proxy server

First we start with Mozilla Firefox browser. Click Tools menu and choose Options....

Squid cache proxy client Firefox setup image

In 'Options' window, choose Advanced tab. There are General, Network, Update and Encryption tabs. Choose Network and in the 'Connection section', click Settings... to configure how Firefox connects to the Internet.

Squid cache proxy client Firefox setup image2

In 'Connection Settings' window, click Manual proxy configuration and key in 'HTTP Proxy' and 'Port'. Don't forget to tick Use this proxy server for all protocols.

Squid cache proxy client Firefox setup image3

Click OK and you are done. If you forgot to tick 'Use this proxy server for all protocols' as mention above, you'll have trouble to connect to any https sites such as yahoo mail, gmail, etc.

For Internet Explorer browser, follow the steps below to configure Squid cache proxy client:

Open 'Menu bar'.

Squid cache proxy client IE setup image

Click 'Tools' and and choose 'Internet Options'.

Squid cache proxy client IE setup image2

Setup./p>

Squid cache proxy client IE setup image3

Finally, when 'Local Area Network Settings' window pops up, enter Squid proxy server IP address and port in 'Proxy server' section. Click 'OK' and you are done.

Squid cache proxy client IE setup image4

That's all. The basic configuration and setup is done. You just need to study more about Squid and tweaks your squid's configuration to get the best out of it. Good luck and all the best!

Reply

By submitting this form, you accept the Mollom privacy policy.

Custom Search