Syed Jahanzaib – Personal Blog to Share Knowledge !

January 5, 2014

Automated Installation Script for Squid 2.7 Stable 9 with Video Caching support

Filed under: Linux Related — Tags: , — Syed Jahanzaib / Pinochio~:) @ 2:24 AM

squid

For updated video caching support witgh Youtube, you can use LUSCA as it is working fine (as of July 2014)

https://aacable.wordpress.com/2014/04/21/howto-cache-youtube-with-squid-lusca-and-bypass-cached-videos-from-mikrotik-queue/

 


 






 

Following is an automated script to install SQUID 2.7 Stable 9 for UBUNTU with aggressive contents & few video web sites video caching support as described in my other article @
https://aacable.wordpress.com/2012/01/19/youtube-caching-with-squid-2-7-using-storeurl-pl/

I will add more n more functions as soon as I get some free time, like configurable options via choice menu like cache size, mem, and other variables.

Revision History . . .

[ 6th January, 2014]    Removed few bugs including “unable to start squid” error in end, while actually squid is running
[ 7th January, 2014]    Download URL have been changed to http://aacable.rdo.pt/files/linux_related
[ 8th January, 2014]    O.S check for UBUNTU added
[ 8th January, 2014]    root user check added
[ 8th January, 2014]    Function added to remove previously downloaded files in /temp folder to avoid duplication
[ 8th January, 2014]    Internet and $URL availability check
[ 20th January, 2014]  Few refresh patterns + storeurl.pl updated for better YT HIT
[ 29th January, 2014]  aacable.rdo.pt was down dueto quota limit, now added secondary link URL2 = http://wifismartzone.com/files/linux_related/
[ 30th January, 2014]  64bit installation issue fixed.

SCRIPT FUNCTIONS . . . 

This script will do the following

– First it will ask you if you want 32bit or 64 squid compile options
– Update Ubuntu
– Install some components required for Compilation of squid package
– Backup squid.conf if already in /etc/squid.conf with squid.conf.old, stop any running squid instance
– Download Squid 2.7 stable 9 source package to /temp folder and compile it
– Download squid.conf and storeurl.pl from the internet and place them in /etc/squid.conf
– Create cache directory like in /cache-1 and default cache size is 10 GB
– add squid in /etc/rc.local so it may start auto upon system reboot  [added: 5th January, 2014]

Note: You should modify all options in /etc/squid.conf after installation , like cache_dir, cache_mem and others as per your network and hardware specifications.

.

REQUIREMENTS . . .

1- Fresh Installation of UBUNTU OS and Configure Internet Access
2- root access to execute script
3- REMOVE ANY KIND OF PREVIOUSLY INSTALLED SQUID INSTALLATION IF ANY
4- Upload or create script in any folder of Ubuntu box,

or create new script with following commands

mkdir /temp
cd /temp
touch squid_2.7.9_install.sh
chmod +x squid_2.7.9_install.sh

nano squid_2.7.9_install.sh

and paste the following code . . .


#!/bin/bash
# Version 1.3 / 31st January, 2014
# SQUID 2.7 Stable9 Automated Installation Script for Ubuntu 10/12 32bit Edition
# Syed Jahanzaib / aacable @ hotmail.com  / https://aacable.wordpress.com

# Setting Variables . . . [JZ]
#URL=http://aacable.rdo.pt/files/linux_related/
URL=http://wifismartzone.com/files/linux_related/
SQUID_DIR="/etc/squid"
CACHE_DIR="/cache-1"
pid=`pidof squid`
osver=`cat /etc/issue |awk '{print $1}'`

# Colors Config  . . . [[ JZ . . . ]]
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"

# OS checkup for UBUNTU
echo -e "$COL_GREEN Squid 2.7.9 Automated Installation Script ver 1.3 for Ubuntu . . .$COL_RESET"
echo -e "$COL_GREEN Checking OS version, as it must be Ubuntu in order to Continue . . .$COL_RESET"
if [[ $osver == Ubuntu ]]; then
echo
echo -e "$COL_GREEN Ubuntu is installed with following information fetched. $COL_RESET"
lsb_release -a
sleep 3
else
echo -e "$COL_RED Sorry, it seems your Linux Distribution is not UBUNTU . Exiting ...$COL_RESET"
exit 1
fi

# Make sure only root can run our script / Checking if user is root, otherwise exit with error [[Jz]]
echo
echo -e "$COL_GREEN Verifying if you are logged in with root privileges  . . .$COL_RESET" 1>&2
FILE="/tmp/out.$$"
GREP="/bin/grep"
if [ "$(id -u)" != "0" ]; then
echo
echo -e "$COL_RED This script must be run as root, switch to root now . . .$COL_RESET" 1>&2
exit 1
fi

# Clearing previous download if any in /temp folder
echo
echo -e "$COL_GREEN Clearing previous downloads if any in /temp folder to avoid duplication$COL_RESET"
sleep 3
rm -fr /temp/squid.conf
rm -fr /temp/storeurl.txt
rm -fr /temp/storeurl.pl
rm -fr /temp/squid-2.7.STABLE9*

# Checking IF $URL is accessible m if YES then continue further , otherwise EXIT the script with ERROR ! [[ JZ .. . .]]
echo
echo -e "$COL_GREEN Checking if $URL is accessible in order to proceed further. . .!! $COL_RESET"
cd /temp
wget -q $URL/squid.conf
{
if [ ! -f /temp/squid.conf ]; then
echo
echo -e "$COL_RED ERROR: Unable to contact $URL, or possibly itnernet is not working or your IP is in black list at destination server  !! $COL_RESET"
echo -e "$COL_RED ERROR: Please check manual if $URL is accessible or not or if it have required files, JZ  !! $COL_RESET"
exit 0
fi
}
rm -fr /temp/squid.conf
sleep 6
# Moving further . . .

clear
echo -e "$COL_GREEN You are logged in with root ID, Ok to proceed further . . .!! $COL_RESET"
echo
#################################################################
# Selection choice of SQUID 2.7  32bit or 64bit architecture [zaib]
echo -e "$COL_GREEN ********************************************** $COL_RESET"
echo -e "$COL_GREEN   Select the type of your OS Architecture JZ   $COL_RESET"
echo -e "$COL_GREEN ********************************************** $COL_RESET"
echo
echo
echo "1. 32bit Ububtu [If you have 32bit OS]"
echo "2. 64bit ubuntu [If you have 64bit OS]"
echo
echo -n "Choose an option: [1] "

read squidchoice
if [ -z "$squidchoice" ]; then
squidchoice="1"
fi
case $squidchoice in
1 ) echo "Selected Squid version is 32bit"
squidver="./configure --prefix=/usr --exec_prefix=/usr --bindir=/usr/sbin --sbindir=/usr/sbin --libexecdir=/usr/lib/squid --sysconfdir=/etc/squid --localstatedir=/var/spool/squid --datadir=/usr/share/squid --enable-async-io=24 --with-aufs-threads=24 --with-pthreads --enable-storeio=aufs --enable-linux-netfilter --enable-arp-acl --enable-epoll --enable-removal-policies=heap,lru --with-aio --with-dl --enable-snmp --enable-delay-pools --enable-htcp --enable-cache-digests --disable-unlinkd --enable-large-cache-files --with-large-files --enable-err-languages=English --enable-default-err-language=English --with-maxfd=65536"
squidlabel="Squid 32bit"
sleep 1
;;
2 ) echo "Selected Squid version is 64bit"
squidver="./configure --prefix=/usr --exec_prefix=/usr --bindir=/usr/sbin --sbindir=/usr/sbin --libexecdir=/usr/lib/squid --sysconfdir=/etc/squid --localstatedir=/var/spool/squid --datadir=/usr/share/squid --enable-async-io=24 --with-aufs-threads=24 --with-pthreads --enable-storeio=aufs --enable-linux-netfilter --enable-arp-acl --enable-epoll --enable-removal-policies=heap,lru --with-aio --with-dl --enable-snmp --enable-delay-pools --enable-htcp --enable-cache-digests --disable-unlinkd --enable-large-cache-files --with-large-files --enable-err-languages=English --enable-default-err-language=English --with-maxfd=65536 --enable-carp --enable-follow-x-forwarded-for --with-maxfd=65536 build_alias=amd64-debian-linux host_alias=amd64-debian-linux target_alias=amd64-debian-linux"
squidlabel="Squid 64bit"

echo .
sleep 3

# If typ anythign other then 1 adn 2, then give invalid error message and exit [zaib]
;;
* ) echo "Invalid selection. Installation aborted."
echo
exit
;;
esac

################################################################## [zaib]
echo
echo -e "$COL_GREEN Updating Ubuntu first . . . !! $COL_RESET"
apt-get update

echo
echo

echo -e "$COL_GREEN Installing required components . . . !! $COL_RESET"
sleep 3
apt-get -y install gcc build-essential sharutils ccze libzip-dev automake1.9

# Clearing OLD data files . . .
{
if [ -f $SQUID_DIR/squid.conf ]; then
echo
echo
echo -e "$COL_RED Previous SQUID configuration file found in $SQUID_DIR ! renaming it for backup purpose . . . $COL_RESET"
mv $SQUID_DIR/squid.conf $SQUID_DIR/squid.conf.old
else
echo
echo
echo -e "$COL_GREEN No Previous Squid configuration have been found in $SQUID_DIR. Proceeding further $COL_RESET"
fi
}

# Checking SQUID status if its already running - check by PID
if [ "$pid" == "" ]; then
echo
echo
echo -e "$COL_GREEN No SQUID instance found in memory , so it seems we are good to GO !!! $COL_RESET"
else
echo
echo -e "$COL_RED SQUID is already running, probably you have some previous copy of SQUID installation, Better to stop and remove all previous squid installation !! $COL_RESET"
echo
echo -e "$COL_RED KILLING PREVIOUS SQUID INSTANCE by killall -9 squid command  !! $COL_RESET"
killall -9 squid
sleep 3
fi

# Downloading Squid source package [zaib]
echo
echo
echo -e "$COL_GREEN Downloading SQUID source package in /temp folder. . . !! $COL_RESET"
sleep 3

# Checking if /temp folder is previously present or not . . .
{
if [ ! -d "/temp" ]; then
echo
echo
echo -e "$COL_RED /temp folder not found, Creating it so all downlaods will be placed here  . . . $COL_RESET"
mkdir /temp
else
echo
echo -e "$COL_GREEN /temp folder is already present , so no need to create it, Proceeding further . . . $COL_RESET"
fi
}

cd /temp

# Checking IF SQUID 2.7 Stable9 installation file have been ALREADY downloaded in /temp to avoid duplication! [[ JZ .. . .]]
{
if [ -f /temp/squid-2.7.STABLE9+patch.tar.gz ]; then
rm -fr /temp/squid-2.7.STABLE9+patch.tar.gz
fi
}

wget https://mikrotik-squid.googlecode.com/files/squid-2.7.STABLE9%2Bpatch.tar.gz

# Checking IF SQUID 2.7 Stable9 installation file have been downloaded properly. if YEs continue further , otherwise EXIT the script with ERROR ! [[ JZ .. . .]]
{
if [ ! -f /temp/squid-2.7.STABLE9+patch.tar.gz ]; then
echo
echo

echo -e "$COL_RED ERROR: SQUID source code package File could not be download or not found in /temp/ !! $COL_RESET"
exit 0
fi
}
echo
echo

echo -e "$COL_GREEN Extracting Squid from tar archive. . . !! $COL_RESET"
sleep 3
tar zxvf squid-2.7.STABLE9+patch.tar.gz
cd squid-2.7.STABLE9
mkdir /etc/squid

echo -e "$COL_GREEN Executing $squidlabel Compiler which you have selected architecture type in start menu . . . !! $COL_RESET"
$squidver
echo
echo
echo -e "$COL_GREEN Executing MAKE and MAKE INSTALL commands . . . !! $COL_RESET"
sleep 3
make
make install
echo
echo

echo -e "$COL_GREEN Creating SQUID LOGS folder and assiging permissions . . . !! $COL_RESET"
sleep 3

# Checking if log folder is previously present or not . . .
{
if [ -d "/var/log/squid" ]; then
echo
echo
echo -e "$COL_GREEN LOGS folder found. No ned to create, proceeding ruther . . . $COL_RESET"
else
echo
echo
echo -e "$COL_GREEN Creating LOG Folder in /var/log/squid and setting permissions accordingly (to user proxy) $COL_RESET"
mkdir /var/log/squid
fi
}

chown proxy:proxy /var/log/squid

## ** DOWNLOAD SQUID.CONF
echo
echo
echo -e "$COL_GREEN Downloading SQUID.CONF file from $URL and copy it to $SQUID_DIR. . . !! $COL_RESET"
sleep 3

# Checking IF SQUID.CONF File have been ALREADY downloaded in /temp to avoid duplication! [[ JZ .. . .]]
{
if [ -f /temp/squid.conf ]; then
rm -fr /temp/squid.conf
fi
}

cd /temp
wget $URL/squid.conf

# Checking IF SQUID.CONF file have been downloaded. if YEs continue further , otherwise EXIT the script with ERROR ! [[ JZ .. . .]]
{
if [ ! -f /temp/squid.conf ]; then
echo
echo
echo -e "$COL_RED ERROR: SQUID.CONF File could not be download or not found in /temp/ !! $COL_RESET"
exit 0
fi
}
cp -fr squid.conf $SQUID_DIR

## ** DOWNLOAD SQUID.CONF
echo
echo
echo -e "$COL_GREEN Downloading STOREURL.PL file from $URL and copy it to $SQUID_DIR. . . !! $COL_RESET"
sleep 3
cd /temp

{
if [ -f /temp/storeurl.txt ]; then
rm -fr /temp/storeurl.txt
fi
}

wget $URL/storeurl.txt

{
if [ -f /temp/storeurl.pl ]; then
rm -fr /temp/storeurl.pl
fi
}

mv storeurl.txt storeurl.pl

# Checking IF STOREURL.PL file have been downloaded. if YEs continue further , otherwise EXIT the script with ERROR ! [[ JZ .. . .]]
{
if [ ! -f /temp/storeurl.pl ]; then
echo
echo
echo -e "$COL_RED ERROR: STOREURL.PL File could not be download or not found in /temp/ !! $COL_RESET"
exit 0
fi
}
cp -fr storeurl.pl $SQUID_DIR

echo
echo
echo -e "$COL_GREEN Setting EXECUTE permission for storeurl.pl . . . !! $COL_RESET"
chmod +x $SQUID_DIR/storeurl.pl

# Creating CACHE folders
echo
echo
echo -e "$COL_GREEN Creating CACHE directory in $CACHE_DIR , in this example,I used 10GB for cache, adjust it accordingly  . . . !! $COL_RESET"
sleep 3

# Checking if /cache-1 folder exist  . . .
{
if [ ! -d "$CACHE_DIR" ]; then
echo
echo
echo -e "$COL_GREEN Creating cache folder in $CACHE_DIR , Default size is 10GB, you should set it accordingly to your requirements  . . . $COL_RESET"
mkdir $CACHE_DIR
chown proxy:proxy $CACHE_DIR
squid -z
chmod 777 -R $CACHE_DIR
else
echo
echo -e "$COL_RED $CACHE_DIR folder already exists , Clearing it before proceeding. . . $COL_RESET"
rm -fr $CACHE_DIR/*
chown proxy:proxy $CACHE_DIR
echo -e "$COL_GREEN $CACHE_DIR Initializing Cache Directories as per the config  . . . $COL_RESET"
echo
squid -z
chmod 777 -R $CACHE_DIR
fi
}

echo
echo
echo -e "$COL_GREEN Adding squid in /etc/rc.local for auto startup . . . !! $COL_RESET"
sed -i '/exit/d' /etc/rc.local
sed -i '/[/usr\/sbin\/squid]/d' /etc/rc.local
echo /usr/sbin/squid >> /etc/rc.local
echo exit 0 >> /etc/rc.local
echo
echo -e "$COL_GREEN Starting SQUID (and adding 10 seconds Pause for proper initialization). . . !! $COL_RESET"
squid
sleep 5

# Checking SQUID status via PID [zaib]
#if [ "$pid" == "" ]; then
#echo
#echo -e "$COL_RED ERROR: UNABLE to start SQUID, try to run with -d1N syntax and see where its showing error !! $COL_RESET"
#else
ps aux |grep squid
echo
echo -e "$COL_GREEN $squidlabel is Running OK with PID number "$pid", no further action required, EXITING  . . .$COL_RESET"
echo
echo To view squid web access activity log, use command
echo -e "$COL_GREEN tail -f /var/log/squid/access.log $COL_RESET"
echo OR
echo -e "$COL_GREEN tail -f /var/log/squid/access.log |ccze $COL_RESET"
echo
echo -e "$COL_GREEN Regard's / Syed Jahanzaib . . . !! $COL_RESET"
echo

☺♥

.

.

.

.

Regard’s
Syed Jahanzaib

98 Comments »

  1. How i can install this file (squid_2.7.9_install.sh) ????

    And Thank you..

    Like

    Comment by mustafa — January 5, 2014 @ 3:17 AM

  2. Will it work with squid v3?

    Like

    Comment by srijit — January 5, 2014 @ 9:13 AM

  3. Sir……………….how to install it?
    we……………..can’t understand this plz guide step by step
    ALLAH ……AAp Ko Jaza e Khair Dey…

    Like

    Comment by Salman — January 5, 2014 @ 1:01 PM

    • First you might need to give the .sh file permission to execute. chmod +x squid_2.7.9_install.sh , then you can execute it with ./squid_2.7.9_install.sh

      then the menu of wizard install will appear

      Like

      Comment by alfanet1 — January 5, 2014 @ 1:32 PM

  4. Salam Alikum thank you for the great tutorial …

    Like

    Comment by alfanet1 — January 5, 2014 @ 1:18 PM

  5. Hello at the end of installation I got this error

    ./squid_2.7.9_install.sh: line 287: syntax error: unexpected end of file

    I tried squid works but video cache from youtube is not working with all videos !!
    also I noticed that squid wait long time to finish the page loading page already opened but show like page is not finished completely and the browser keep working …
    if possible to add squid to run at startup with this script that will be good also , coz after reboot squid not running

    Like

    Comment by alfanet1 — January 5, 2014 @ 2:37 PM

    • – I have thoroughly checked the script and not faced any un expected error. thats why I added many fail safe options in it.
      – directives have been added in the script to add Squid at startup using /etc/rc.local

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 5, 2014 @ 3:07 PM

  6. Hello Syed, very great work, I will try it tomorrow on the network for control room. I have some questions about configuration on different scenario.
    How many lan card may have this proxy server?
    I have a strange (but not so strange) network configuration:

    | >>> LOG SERVER 172.16.X.X/30
    |
    internet >WAN > RB1100AHx2 >|>>> USERS FROM CONTROL ROOM 192.168.1.0/24
    PUBLIC ip |
    | >>> LAN RADIUS SERVERS WITH RM-4 10.1.X.X/24
    |
    | >>> LAN USERS FROM BACKBONE 10.1.X.X/24

    PPPoE is on any point of distributioin, nothing on the core router
    It must be transparent because RB1100 is configured for loggin all traffic and send it to syslog server (I need to do it for laws rules)

    Where I had to put it?
    With a single LAN card connected to RB1100 with proper configuration? (how to do it?) maybe not the best!
    Otherwise how connect it into my network?
    p.s. my RB1100 is also used for different public IP’s redirected to some clients that need public IP, all other users are natted!

    I had spent many times to find a solution but the only I found was with only one lan card. Do you have any idea?
    Any suggestion will be helpful.
    Thanks and best regards.
    Ivan

    Like

    Comment by Ivan — January 5, 2014 @ 4:20 PM

  7. Sir…………how to install squid in ubuntu desktop 12.04……with this script
    how to run this scripts

    Like

    Comment by Salman — January 5, 2014 @ 7:33 PM

  8. Sir…………i have get this ERROR: UNABLE to start SQUID, try to run with -d1N syntax and see where its showing error !!

    Like

    Comment by Salman — January 5, 2014 @ 8:58 PM

  9. bro please let it cache applications from google play store and Apple store that will be good also in the new modification …

    ** directives have been added in the script to add Squid at startup using /etc/rc.local
    I checked it and nothing inside rc.local also I got these errors : I am using root account also tried it with sudo
    I installed it in another machine to check this great script and the same in both versions 32 bit and 64 bit I got these errors and as soon as the new script realized it will be my pleasure to test it and work on it .

    /usr/bin/install -c -m 644 ./English/ERR_ACCESS_DENIED /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_CACHE_ACCESS_DENIED /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_CACHE_MGR_ACCESS_DENIED /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_CANNOT_FORWARD /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_CONNECT_FAIL /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_DNS_FAIL /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_FORWARDING_DENIED /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_FTP_DISABLED /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_FTP_FAILURE /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_FTP_FORBIDDEN /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_FTP_NOT_FOUND /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_FTP_PUT_CREATED /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_FTP_PUT_ERROR /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_FTP_PUT_MODIFIED /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_FTP_UNAVAILABLE /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_INVALID_REQ /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_INVALID_RESP /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_INVALID_URL /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_LIFETIME_EXP /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_NO_RELAY /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_ONLY_IF_CACHED_MISS /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_READ_ERROR /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_READ_TIMEOUT /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_SHUTTING_DOWN /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_SOCKET_FAILURE /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_TOO_BIG /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_UNSUP_REQ /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_URN_RESOLVE /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_WRITE_ERROR /usr/share/squid/errors/English
    /usr/bin/install -c -m 644 ./English/ERR_ZERO_SIZE_OBJECT /usr/share/squid/errors/English
    make[2]: Leaving directory `/temp/squid-2.7.STABLE9/errors’
    make[1]: Leaving directory `/temp/squid-2.7.STABLE9/errors’

    Like

    Comment by alfanet1 — January 5, 2014 @ 11:24 PM

    • echo -e “Adding squid in /etc/rc.local for auto startup . . . !! ”
      sed -i ‘/exit/d’ /etc/rc.local
      sed -i ‘/[/usr\/sbin\/squid]/d’ /etc/rc.local
      echo /usr/sbin/squid >> /etc/rc.local
      echo exit 0 >> /etc/rc.local

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 6, 2014 @ 8:17 AM

  10. I would recommend that hardware for a wireles network with 500 users of Connect:

    256 k / 1 M – up / down with an internet link 30M?.

    thanks

    Like

    Comment by Ariel — January 6, 2014 @ 1:56 AM

    • 500 concurrent sessions? or 500 total number of users?
      If you are talking about 500 concurrent connections, then surely 30M is like Peanut in Camel’s mouth 😉 You should at least double it.
      If you talking about 500 total users, so we can assume that in peak timings, average of 250-300 users will get online, so about 30-40 Mb should be enough, but it really depends on how much packages you have offered to users.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 6, 2014 @ 8:15 AM

      • Users 500 in total, and about 250/300, simultaneous.
        and I have 38 M intrenet.

        Like

        Comment by Ariel — January 6, 2014 @ 3:47 PM

  11. sir…………..we have ubuntu 12.04 all things are working but ……we are reboot system than internet sharing r not working.
    than ….enter this command ( sudo /etc/fw.sh ) than working ok……how to solve that problem?
    Allah aap ko jaza e khair dain…….

    Like

    Comment by salman — January 6, 2014 @ 10:40 AM

    • you should first post your current /etc/rc.local here, then I can recommend some suggestions . . .

      if default rc.local is there, then use the following code: (simply copy paste it on terminal (using root user) )

      sed -i '/exit/d' /etc/rc.local
      echo /etc/fw.sh >> /etc/rc.local
      echo exit 0 >> /etc/rc.local

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 6, 2014 @ 11:24 AM

      • thank you bro , I pasted the commands but I got this error also squid still not running at start up
        root@ubuntu:~# sed -i ./exit/d. /etc/rc.local
        sed: -e expression #1, char 1: unknown command: `.’
        hope to fix everything in the new realize for this script

        Like

        Comment by alfanet1 — January 6, 2014 @ 10:37 PM

      • thats the problem of copy pasting from wordpress without coding tab.
        Copy directly from the script section, or check it again, I have wrapped it with code tags

        Like

        Comment by Syed Jahanzaib / Pinochio~:) — January 6, 2014 @ 11:08 PM

  12. I tried on another machine with ubuntu server 64 bit 13.10 lastest version of ubuntu and I followed the same steps of the version 12 but I got these errors :
    if you have squid_2.7.9_install.sh file please upload it if the problem from copy and paste

    thank you

    -e \x1b[32;01m Setting EXECUTE permission for storeurl.pl . . . !! \x1b[39;49;00m
    chmod: cannot access ق/etc/squid/storeurl.plق: Not a directory

    -e \x1b[32;01m Creating CACHE directory in /cache-1 , in this example,I used 10GB for cache, adjust it accordingly . . . !! \x1b[39;49;00m

    -e \x1b[32;01m Creating cache folder in /cache-1 , Default size is 10GB, you should set it accordingly to your requirements . . . \x1b[39;49;00m
    ./squid_2.7.9_install.sh: 257: ./squid_2.7.9_install.sh: squid: not found

    -e \x1b[32;01m Starting SQUID . . . !! \x1b[39;49;00m
    ./squid_2.7.9_install.sh: 271: ./squid_2.7.9_install.sh: squid: not found
    ./squid_2.7.9_install.sh: 287: ./squid_2.7.9_install.sh: Syntax error: end of file unexpected (expecting “fi”)
    root@ubuntu:/temp# chown proxy:proxy $CACHE_DIR
    chown: missing operand after قproxy:proxyق
    Try ‘chown –help’ for more information.

    Like

    Comment by alfanet1 — January 7, 2014 @ 4:51 PM

  13. Sir…….Thanks a lot thats working……good in ubuntu 10.04 but
    ubuntu 12.04 is not creating (root user)
    How shall we create (root user) in ubuntu 12.04…….?
    ALLAH …….Aap Ko Jaza e Khair Dain….!

    Like

    Comment by Salman — January 7, 2014 @ 5:32 PM

    • the same password you created it at install use this command sudo -i
      then enter the password you will be root user

      Like

      Comment by alfanet1 — January 7, 2014 @ 7:30 PM

      • salam sir main mikrotik 5.20 intal keya ha par usk dns ip ki samaj nahi a rahe k kon sa do plz ap say request hai bta dain

        Like

        Comment by Sahil Gee — January 28, 2014 @ 11:44 AM

    • use this command at terminal.

      sudo passwd root

      then enter your current user password, then it will ask you to enter root password two times, then it will change the root password , then simply log off and login with root id or use su command to login with root and execute the script.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 9, 2014 @ 8:55 AM

  14. Thanks …………….Bhai its working ..
    can i change ……..password expiry permition ……..by this command
    sudo passwd -u root

    Like

    Comment by Salman — January 8, 2014 @ 12:47 PM

  15. Sir……………..for this configuration required ( dnsmasq ) or not ?
    ALLAH aap ko Jaza e Khair dey……Ameen

    Like

    Comment by Salman — January 9, 2014 @ 12:15 AM

    • dnsmasq is a just a simple dns caching application, if its installed and you have configured your resolv.conf and squid.conf to use it , then its a slight benefit for fast resolving the hostname, useful in load conditions.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 9, 2014 @ 8:38 AM

  16. Sir ………….I have 12 GB Ram which go to used within 10 hours and squid box goi
    ng on slowdown look at this
    root@ubuntu-desktop:~# free -m
    total used free shared buffers cached
    Mem: 12042 11974 68 0 763 9225
    -/+ buffers/cache: 1984 10057
    Swap: 35277 0 35277
    thats my Memory Size setting in squid.conf
    cache_mem 256 MB
    minimum_object_size 0 bytes
    maximum_object_size 1024 MB
    maximum_object_size_in_memory 512 KB
    Sir ………..how to resolved this problem..?
    ALLAH aap ko jaza e khair dey.

    Like

    Comment by Salman — January 10, 2014 @ 1:02 AM

  17. Sir ………….I have 12 GB Ram which go to used within 10 hours and squid box go
    on slowdown than hang…………… look at this
    root@ubuntu-desktop:~# free -m
    …………total…………used….. free……shared…. buffers….cached
    Mem: 12042……….11974……68……….0………….763………9225
    -/+ buffers/cache:…1984……10057
    Swap:.35277…………0…….. 35277
    thats my Memory Size setting in squid.conf
    cache_mem 256 MB
    minimum_object_size 0 bytes
    maximum_object_size 1024 MB
    maximum_object_size_in_memory 512 KB
    Sir ………..how to resolved this problem..?
    ALLAH aap ko jaza e khair dey.

    Like

    Comment by Salman — January 10, 2014 @ 1:16 AM

  18. I have the same problem if possible to fix this issue in memory will be great , but I dnt know if this will help you .

    Clear Memory in Linux Box

    I already did it now much better every 24 hrs will wipe unused memory …

    Like

    Comment by alfanet1 — January 11, 2014 @ 2:14 PM

  19. syeh i m from indonesia,, and i see from the squid forum in fcbook there is a squid that can chache https and youtube and etc,,, this is the lin of the file https://www.facebook.com/groups/Mikrotik.Squid.Indonesia/655623551150586/ ,, colud you please based on that file make an automatic scrip for install that kind of squid proxy,, or may be that file can become your reference in making new squid https and youtube cache tutorial,, just for sugggestion heheh

    Like

    Comment by warnetbuntamas — January 15, 2014 @ 7:22 PM

    • I have used squid 3.4.2 but I have seen no major difference in performance. The squid 2.7 is still able to cache the youtube and other contents very well.
      Caching HTTPS is not advised / not recommended. If you have limited users like cafe where you have full control over users pc, then you can import your created certificate and import in users browsers, works ok, but still then https caching does not work properly 🙂 So just CHILL 😉

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 17, 2014 @ 7:20 PM

  20. I try it today, works perfectly without error. very great. I use normal install with ubuntu 12.10 32bit and no problems.
    The problem will be how use in my situation 😉 but I will try (see previus post)
    Best regards

    Like

    Comment by Ivan — January 16, 2014 @ 2:43 PM

  21. Assalamualaikum,,,

    this script running smoothly and it install everything erfectly. but still, caching youtube still not working. any advise brother???

    Like

    Comment by essentialjayJaya Duana — January 27, 2014 @ 10:26 AM

    • I tested above script at remote network and check the YouTube video caching is working fine.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 28, 2014 @ 3:11 PM

      • i’ve test it 3 times, and still caching youtube is not working. sometimes it shows that caching youtube is working, but only for first or second range of the video, rest is not cached. any suggestion brother, or can it becoz i’m in Indonesia?

        Like

        Comment by essentialjay — January 31, 2014 @ 11:31 AM

  22. sir…………this link is not open……..http://aacable.rdo.pt/files/linux_related
    showing errors below
    Bandwidth Limit Exceeded
    The server is temporarily unable to service your request due to the site owner reaching his/her bandwidth limit. Please try again later
    ERROR: Unable to contact http://aacable.rdo.pt/files/linux_related/, or possibly itnernet is not working or your IP is in black list at destination server !!

    Like

    Comment by Salman — January 29, 2014 @ 5:33 AM

  23. Sir …………this link is not working.”http://aacable.rdo.pt/files/linux_related”
    showing error
    Bandwidth Limit Exceeded
    The server is temporarily unable to service your request due to the site owner reaching his/her bandwidth limit. Please try again later.

    Like

    Comment by Salman — January 29, 2014 @ 6:46 AM

  24. Thank you Sir……………..!
    ALLAH aap ko jaza e khair dain…………….Ameen

    Like

    Comment by Salman — January 29, 2014 @ 5:44 PM

  25. Reblogged this on Henri Sekeladi – Sebuah Catatan Perjalanan and commented:
    Add your thoughts here… (optional)

    Like

    Comment by rihend — January 29, 2014 @ 6:08 PM

  26. thank you sir ….

    i have problem in 64 bi in ubuntu 12.10 it,s tell me error in ./configuration but it,s work fine in 32 bit

    i have cpu core2qoud 3/12 ram 8 G adata 1600mghz and HDD 1TB my speed 10M for 250 user online 90 to 120

    what best cache_mem and cache_dir space for me !!!!!!!!

    and this is grate work go ahead

    Like

    Comment by Mostafa Mohamed — January 30, 2014 @ 12:53 AM

  27. thank you sir ….

    i have problem in 64 bit in ubuntu 12.10 it,s tell me error in ./configuration but it,s work fine in 32 bit

    i have cpu core2qoud 3/12 ram 8 G adata 1600mghz and HDD 1TB my speed 10M for 250 user online 90 to 120

    what best cache_mem and cache_dir space for me !!!!!!!!

    and this is grate work go ahead

    Like

    Comment by Mostafa Mohamed — January 30, 2014 @ 12:57 AM

    • 64bit installation fixed now.
      for cache_mem you can try starting with 2 or 3 GB
      for cache_dir, you can go with assigning 70% of total space.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 31, 2014 @ 10:19 AM

      • thanks for you

        i will try 64 bit now but i want know what is best os for squid i am used ubuntu 12.10 64 bit

        Like

        Comment by Mostafa Mohamed — February 1, 2014 @ 7:02 AM

  28. youtube video is not caching ….. Plzz Help

    Like

    Comment by smn4all — January 30, 2014 @ 2:03 AM

  29. i cant show my post

    Like

    Comment by Mostafa Mohamed — January 30, 2014 @ 2:18 AM

  30. cannot download storeurl.pl
    better using googlecode to avoid limit exceed

    Like

    Comment by iamspalham — January 31, 2014 @ 6:21 PM

    • i guess its issue with he web server that .pl cannot be download deuto some restrictions, therefore in script i used .txt to download and then rename it to .pl

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — February 2, 2014 @ 11:05 AM

  31. sir
    i cant download storeurl.pl at http://wifismartzone.com/files/linux_related/storeurl.pl or http://aacable.rdo.pt/files/linux_related/storeurl.pl
    both site give me Internal Server Error
    please help me….
    can you move up the file to another site like codes.google.com?

    Like

    Comment by iamspailham — February 3, 2014 @ 3:13 AM

  32. or you can archive the file using winrar or similiar program…
    thanks for helping

    Like

    Comment by iamspailham — February 3, 2014 @ 3:14 AM

  33. Sir………………we have this erorr…..parseConfigFile: squid.conf:51 unrecognized: ‘referer_log’
    but squid are running good…….what we do about this error……..?
    ALLAH aap ko jaza e khair dey……………

    Like

    Comment by Salman — February 3, 2014 @ 3:49 AM

  34. Sir…………..We noticed that squid wait long time to finish the page loading page already opened but show like page is not finished completely and the browser keep working …
    Explain about this problem…….!

    Like

    Comment by Salman — February 4, 2014 @ 9:21 PM

  35. Sir……….what is a meaning of this line…..”acl manager proto cache_object”
    Can i added this line in yours squid.conf file….?

    Like

    Comment by Salman — February 6, 2014 @ 2:48 AM

  36. Sir………….squid wait long time to finish the page loading page already opened but
    show like page is not finished completely and the browser keep working …
    Explain about this problem…….!
    Allah aap ko jaza e kair deain……………..

    Like

    Comment by Salman — February 6, 2014 @ 6:05 PM

  37. salam
    How to restart squid cli
    thanks

    Like

    Comment by Hesham Saad — February 7, 2014 @ 3:45 AM

  38. Salam janzaib
    i tried this script in centos but it stop would not run plzzz if u have time then post a centos script for automatic squid with video cache support or just make a post with information that what should i have to change
    storeurl.pl
    my lusca/squid did not analys referer_log i also create a file in squid/logs/referer.log and also permissions but it still cant analys
    plz provide some info to whats new in storeurl.pl and squid that can make me easy to change in centos. thanks ur attention and time for people like me.

    Like

    Comment by rehmat ali — February 10, 2014 @ 9:24 AM

  39. one another question i have to ask from u zaib is this script cache youtube videos in HTTPS? or HTTP bcoz in HTTP here in PAK still yt is blocked.
    and i have done all settings in centos i read ur comments and remove referer line from squid and i m running this squid.conf config in lusca/squid from https://aacable.wordpress.com/2012/01/11/howto-cache-youtube-with-squid-lusca-and-bypass-cached-videos-from-mikrotik-queue/
    my squid was make from this guide
    i also paste storeurl.pl and also create a log file named yt.log in logs but youtube videos did not playing
    yt videos ends before start and when i m watching logs of store.log look like this
    1391994149 out: 0 http://video-srv.youtube.com.SQUIDINTERNAL/itag=140&id=593f55e5e13a4f2c&range=0-237567&redirect_counter=1 192.168.9.2/- – GET – myip=…………………… myport=8080
    1391994150 in : 0 http://redirector.googlevideo.com/videoplayback?algorithm=throttle-factor&burst=40&clen=913476&cpn=g-GOz3CyOIwdKFrG&dur=13.630&expire=1392017437&factor=1.25&fexp=933407%2C910100%2C936330%2C916625%2C937417%2C913434%2C936910%2C936913&fr=yes&gir=yes&id=593f55e5e13a4f2c&ip=182.178.57.216&ipbits=0&itag=134&keepalive=yes&key=yt5&lmt=1391027189702229&ms=au&mt=1391994253&mv=m&range=0-1134591&ratebypass=yes&signature=4082372EAB47193E6CDA5195CFD44F8DF937DACF.31679BF84C62224B86834EAAAF8E1095C0E169E4&source=youtube&sparams=algorithm%2Cburst%2Cclen%2Cdur%2Cfactor%2Cgir%2Cid%2Cip%2Cipbits%2Citag%2Clmt%2Csource%2Cupn%2Cexpire&sver=3&upn=xJE3PcSussA&redirect_counter=1&cmo=hh=r5—sn-2uja-3ipz.googlevideo.com&cmo=rr=79&cmo=rs=sn-2uja-3ipz76&cmo=td=googlevideo.com ………………………./- – GET – myip=……………… myport=8080

    i guess this is bcoz of i m not installing fresh one squid 2.7 with patch and make , ./configure
    but i tried to do from ur auto script i download stable squid from given source from autoscript and extract them in temp but when i m trying to make and make install then its giving error that make file could not find,
    once again i remind u that this all thing i done in Centos not in Ubuntu bcoz i have Centos and i want this in it.
    thxzzzzzzzzzzzzzzzzzzzzz and waiting for ur reply

    Like

    Comment by rehmat ali — February 10, 2014 @ 10:13 AM

  40. Hello Syed, I had installed without error. Now I need to do some things. I had try to read the previus post about caching method but now I am confused. Theese are my needs and questions:
    It works also with only one nic?
    If so how to configure mikrotik for this use considering that it have to be transparent and I had to log ip headers?
    I want add a second disk 1Tb used only for cache but maybe could be greater, do you can explain how to on proxy server?
    I belive this will be helpful for many of us.
    Thanks

    Like

    Comment by Ivan — February 10, 2014 @ 8:52 PM

  41. i intall ubuntu 12 on my server and remove centos and i did all of auto script steps in ubuntu result is youtube videos still not playing error occur in flash player ,
    but i m accessing yt by https://youtube.com
    bcoz http://youtube.com is blocked,
    plz send me info what logs u need to resolve this.
    thxzzz

    Like

    Comment by Rehmat Ali — February 11, 2014 @ 1:34 PM

  42. Dear Syed, you have been a great helper doing that automated script. now i have squid on UBUNTU working as parent for squid on pfsense.
    videos are getting cached perfectly, but i am getting so many TCP_MISS when i excute the comand
    tail -f /var/log/squid/access.log | grep MISS
    although i am getting HITs too,
    on my pfsense light-squid report i can see squid handel arround 20GB but with HITs% of 0.1 or 0.7%
    is this related to TCP_MISS? or it is normal to have MISS as well as HIT? although MISS is much more than HIT.

    Best Regards

    Like

    Comment by momothefox — February 13, 2014 @ 9:44 AM

    • Remember, not Everything on web is meant to be cached, there are several contents that can’t or shouldn’t be cached. For example secure sites, dynamic contents and much more. So you will always see lots of Misses as compare to HIT.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — February 13, 2014 @ 9:46 AM

  43. Jahanzaib bhai…. After setting up your this automatic script, I’m getting error… When I’m checking my speed at speed test It show my total network Speed which I have at my core end….. how itz happend??? Can u help me…. When I just stop the route of linux http from mikrotik its shows me speed OK (i.e. which assign to me user bandwidth)?? what to do sir

    Like

    Comment by kashif khan — February 13, 2014 @ 10:16 PM

  44. Hello sir
    Thanks to the topic featured
    Your writing is beautiful and distinctive
    do not know, but little
    I do not know how to correct Internet settings
    Followed these steps is it true or not
    I’m from Yemen
    I ask you to help me

    WAN=eth0 ——-> dhcp
    LAN=eth1 ——-> address 192.168.2.1 ——-> netmask 255.255.255.0
    pc win7 ——-> address 192.168.2.2

    ==========================
    ==========================
    COMMANDS
    ==========================
    ==========================

    1:Create file
    touch /etc/fw.sh

    2:Change permissions
    chmod +x /etc/fw.sh

    3:Edit File
    nano /etc/fw.sh

    (Add the script simple internet sharing)

    4:Run
    /etc/fw.sh

    5:Place shortcut
    /etc/rc.local

    6:Upgrade DNS
    apt-get install dnsmasq

    7:Update system
    apt-get update

    22:Rc Local
    sudo nano /etc/rc.local
    (Add script re.local )

    ===================================
    ===================================
    INTERNET SHARING
    ===================================
    ===================================
    #!/bin/sh

    # ————————————————————————————
    # See URL: http://www.cyberciti.biz/tips/linux-setup-transparent-proxy-squid-howto.html
    # (c) 2006, nixCraft under GNU/GPL v2.0+
    # http:Setokaipa.blogspot.com
    # ————————————————————————————-
    ## Squid Server LAN IP Address
    SQUID_SERVER=”192.168.2.1″
    ## Interface connected to Internet
    INTERNET=”etho”
    ## Interface connected to LAN
    LAN_IN=”eth1″
    ## Squid port
    SQUID_PORT=”8080″

    # Clear old firewall
    iptables -F
    iptables -X
    iptables -t nat -F
    iptables -t nat -X
    iptables -t mangle -F
    iptables -t mangle -X

    ## Load IPTABLES modules for NAT and IP conntrack support
    modprobe ip_conntrack
    modprobe ip_conntrack_ftp

    ## For win xp ftp client
    ## modprobe ip_nat_ftp
    echo 1 > /proc/sys/net/ipv4/ip_forward

    ## Setting default filter policy
    ## iptables -P INPUT DROP
    iptables -P OUTPUT ACCEPT

    ## Unlimited access to loop back
    iptables -A INPUT -i lo -j ACCEPT
    iptables -A OUTPUT -o lo -j ACCEPT

    ## Allow UDP, DNS and Passive FTP
    iptables -A INPUT -i $INTERNET -m state –state ESTABLISHED,RELATED -j ACCEPT

    ## set this system as a router for Rest of LAN
    iptables –table nat –append POSTROUTING –out-interface $INTERNET -j MASQUERADE
    iptables –append FORWARD –in-interface $LAN_IN -j ACCEPT

    ## unlimited access to LAN
    iptables -A INPUT -i $LAN_IN -j ACCEPT
    iptables -A OUTPUT -o $LAN_IN -j ACCEPT

    ## DNAT port 80 request comming from LAN systems to squid 3128 ($SQUID_PORT) aka transparent proxy
    iptables -t nat -A PREROUTING -i $LAN_IN -p tcp –dport 80 -j DNAT –to $SQUID_SERVER:$SQUID_PORT

    ## if it is same system
    iptables -t nat -A PREROUTING -i $INTERNET -p tcp –dport 80 -j REDIRECT –to-port $SQUID_PORT

    ## LOG everything
    iptables -A INPUT -j LOG

    ## Drop Everything else. I m not enabling it, use it at your own.
    ##iptables -A INPUT -j DROP

    ==============================
    ==============================
    RC LOCAL
    ==============================
    ==============================

    #!/bin/sh

    # ————————————————————————————
    # See URL: http://www.cyberciti.biz/tips/linux-setup-transparent-proxy-squid-howto.html
    # (c) 2006, nixCraft under GNU/GPL v2.0+
    # http:Setokaipa.blogspot.com
    # ————————————————————————————-
    ## Squid Server LAN IP Address
    SQUID_SERVER=”192.168.2.1″
    ## Interface connected to Internet
    INTERNET=”etho”
    ## Interface connected to LAN
    LAN_IN=”eth1″
    ## Squid port
    SQUID_PORT=”8080″

    # Clear old firewall
    iptables -F
    iptables -X
    iptables -t nat -F
    iptables -t nat -X
    iptables -t mangle -F
    iptables -t mangle -X

    ## Load IPTABLES modules for NAT and IP conntrack support
    modprobe ip_conntrack
    modprobe ip_conntrack_ftp

    ## For win xp ftp client
    ## modprobe ip_nat_ftp
    echo 1 > /proc/sys/net/ipv4/ip_forward

    ## Setting default filter policy
    ## iptables -P INPUT DROP
    iptables -P OUTPUT ACCEPT

    ## Unlimited access to loop back
    iptables -A INPUT -i lo -j ACCEPT
    iptables -A OUTPUT -o lo -j ACCEPT

    ## Allow UDP, DNS and Passive FTP
    iptables -A INPUT -i $INTERNET -m state –state ESTABLISHED,RELATED -j ACCEPT

    ## set this system as a router for Rest of LAN
    iptables –table nat –append POSTROUTING –out-interface $INTERNET -j MASQUERADE
    iptables –append FORWARD –in-interface $LAN_IN -j ACCEPT

    ## unlimited access to LAN
    iptables -A INPUT -i $LAN_IN -j ACCEPT
    iptables -A OUTPUT -o $LAN_IN -j ACCEPT

    ## DNAT port 80 request comming from LAN systems to squid 3128 ($SQUID_PORT) aka transparent proxy
    iptables -t nat -A PREROUTING -i $LAN_IN -p tcp –dport 80 -j DNAT –to $SQUID_SERVER:$SQUID_PORT

    ## if it is same system
    iptables -t nat -A PREROUTING -i $INTERNET -p tcp –dport 80 -j REDIRECT –to-port $SQUID_PORT

    ## LOG everything
    iptables -A INPUT -j LOG

    ## Drop Everything else. I m not enabling it, use it at your own.
    ##iptables -A INPUT -j DROP

    Like

    Comment by hasan forme — February 16, 2014 @ 1:01 AM

  45. Sir…………..poker is not connecting all users…
    how to solve this problem?
    ALLAH aap ko jaza e khair dey…………….

    Like

    Comment by Salman — February 25, 2014 @ 4:59 AM

  46. Sir……….Thats my senario……..
    5 DSL Routers >>>> Mikrotik LoadBal >>> Squid<<>>MikrotikRouter>>>> Users
    Zynga-Poker…………is not connected of all Users
    how to solve this problem…….?
    ALLAH ………aap ko jaza e khair dey…..

    Like

    Comment by Salman — February 25, 2014 @ 5:15 AM

  47. hallo Syed Jahanzaib
    This method is effective
    But I have a problem
    squid cache take many traffic I do not use it
    Look at this picture

    Hotspot server take 7Mb But LoadBalance Come out of it 12 Mb
    Why squid take This Traffice ??
    My system LoadBalance -=== Squid ====Hotspot server

    Please help me!

    Like

    Comment by New Llife — February 28, 2014 @ 6:20 PM

  48. Dear Mr. Syed.
    i tried Ubuntu 32bit 10.4 LTS with PAE enabled and 8GB of ram.
    i set the cache_dir size to 800GB
    squid needs arround 10MB of ram per 1GB cahce on disk for indexing. so i need about 8 GB of ram
    should i set cache_mem to 8GB or there are some limitations on that?
    or should i put it arround 3 GB and squid will use the rest of RAM for indexing ?
    please advice.

    Like

    Comment by Muhammed Abdelwdoud — March 5, 2014 @ 5:47 AM

  49. Please give me working .sh file. I am working on ubuntu server. (without GUI)

    Like

    Comment by leartlore — March 19, 2014 @ 2:09 PM

  50. Very nice Sir

    Like

    Comment by Sajjad — March 20, 2014 @ 3:25 PM

  51. 10.000 thanks doesen’t looks like too much. THANKS.!!!! great job.

    Like

    Comment by Pablo Fernández — March 29, 2014 @ 2:55 PM

  52. cannot stop squid..every i execute service squid stop output is squid is already running…

    Like

    Comment by rcp — April 1, 2014 @ 10:14 AM

  53. sir youtube caching not working anymore…any update?thanks..

    Like

    Comment by rcp — April 5, 2014 @ 7:23 AM

  54. sir may i ask if this can be done in pfsense squid proxy with multiwan?

    Like

    Comment by kilo — April 7, 2014 @ 12:07 AM

  55. May ALLAH Bless You With Your Family

    Thank You Syed Jahanzaib Brother Nice Work It’s Very Simple

    Like

    Comment by Deal Link — April 7, 2014 @ 7:15 AM

  56. Sir……….Any updates of this article?
    Allah AAp ko jaza e Khair dey…………

    Like

    Comment by Salman — April 24, 2014 @ 7:46 AM

  57. Sir……is ka automatic installation script bana dein……
    ALLAH aap ko JAZA E KHAIR DEY……….

    Like

    Comment by Salman — July 3, 2014 @ 8:45 PM

  58. Hi Syed Jahanzaib

    i have managed to install with the fully automated script and squid is up and running. how to i confirm if youtube videos are been stored, i have browsed youtube via squid on many videos to see if it get cached. for every video the logs are the same.
    access log shows as below

    +0500] “CONNECT r2—sn-qipg55b0-haxe.googlevideo.com:443 HTTP/1.1” 200 1822018 TCP_MISS:DIRECT
    192.168.154.102 – – [08/Aug/2014:22:00:39 +0500] “CONNECT r2—sn-qipg55b0-haxe.googlevideo.com:443 HTTP/1.1” 200 2066191 TCP_MISS:DIRECT
    192.168.154.102 – – [08/Aug/2014:22:00:39 +0500] “CONNECT r2—sn-qipg55b0-haxe.googlevideo.com:443 HTTP/1.1” 200 2126 TCP_MISS:DIRECT
    192.168.154.102 – – [08/Aug/2014:22:00:39 +0500] “GET http://www.youtube.com/watch?v=jAI7rF0eQyQ&spf=navigate HTTP/1.1″ 301 619 TCP_MISS:DIRECT

    store.log

    RELEASE -1 FFFFFFFF 7082D47CAD00680FCDCC9D41BD12A6B0 301 1407516886 -1 41629446 text/html 0/0 GET http://www.youtube.com/watch?v=akX3Is3qBpw&spf=navigate
    1407517090.249 SWAPOUT 00 00000041 30BC6C6F3A9AA7B05D85CEAFD8E9C79D 200 1404618742 1391188875 1436154742 image/png 666/666 GET http://s2.wp.com/wp-content/mu-plugins/post-flair/sharing/images/icon-wordpress.png
    1407517090.249 SWAPOUT 00 00000042 1129A5D0D08654DA7A88261D4AB3F905 200 1407132773 1391188874 1438668773 image/png 581/581 GET http://s2.wp.com/wp-content/mu-plugins/post-flair/sharing/images/icon-facebook.png
    1407517090.249 SWAPOUT 00 00000043 93E692F2C0DD359F73DCF6ABDE0DBDC2 200 1404618742 1355151055 1436154742 image/png 523/523 GET http://s2.wp.com/wp-content/mu-plugins/post-flair/sharing/images/icon-twitter.png
    1407517226.894 RELEASE -1 FFFFFFFF 6E8D251CAF24C06B0D87BC57294DC273 301 1407517039 -1 -1 text/html 0/0 GET http://youtube.com/watch?v=jAI7rF0eQyQ&spf=navigate
    1407517227.020 RELEASE -1 FFFFFFFF 332933BEEA47EDC32D930FAC4C1CBEC2 301 1407517039 -1 41629446 text/html 0/0 GET http://www.youtube.com/watch?v=jAI7rF0eQyQ&spf=navigate
    1407517229.815 RELEASE -1 FFFFFFFF B4ABE6EDD080D3C197BBB0D4698A4677 301 1407517042 -1 -1 text/html 0/0 GET http://youtube.com/watch?v=jAI7rF0eQyQ&spf=navigate
    1407517229.940 RELEASE -1 FFFFFFFF A026D00E337C4943FF63B0DAA3105D61 301 1407517042 -1 41629446 text/html 0/0 GET http://www.youtube.com/watch?v=jAI7rF0eQyQ&spf=navigate
    1407517239.333 RELEASE -1 FFFFFFFF 4191CD82927CB3BA3067DCD081382E8D 301 1407517052 -1 -1 text/html 0/0 GET http://youtube.com/watch?v=jAI7rF0eQyQ&spf=navigate
    1407517239.576 RELEASE -1 FFFFFFFF F72EF3B0190AB869AD80E362CB050F79 301 1407517052 -1 41629446 text/html 0/0 GET http://www.youtube.com/watch?v=jAI7rF0eQyQ&spf=navigate

    and directory cache-1 is only 1,801KiB

    i suppose youtube videos are not been cached or stored. can you please help.

    Like

    Comment by Mohamed Musthafa — August 8, 2014 @ 10:13 PM

  59. Hi Syed Jahanzaib
    Finally got it working. i forgot to install videocache, after installing now i can see downloaded videos on the vidoecache store. break.com and youtube vidoes are also working. thanks for the one touch install scrip.

    videocache.log

    09/Aug/2014:18:14:00 26691 INFO 192.168.154.102 BREAKCOM URL_HIT what_guys_really_think_new_endings2-thumbnail.mp4 http://video1.break.com/dnet/media/2007/3/what_guys_really_think_new_endings2-thumbnail.mp4?1B608EE7AFCE3765E176F3C6FBB98002B3D18C64572F2307D769AC72A57CF2BC74BB
    09/Aug/2014:18:14:00 26691 INFO 192.168.154.102 BREAKCOM CACHE_HIT what_guys_really_think_new_endings2-thumbnail.mp4 Video was served from cache using the URL 302:http://192.168.154.138:8080/videocache/break/what_guys_really_think_new_endings2-thumbnail.mp4
    09/Aug/2014:18:33:06 26691 INFO 192.168.154.102 YOUTUBE URL_HIT leXo4-QLNVc http://www.youtube.com/watch?v=leXo4-QLNVc&spf=navigate
    09/Aug/2014:18:33:08 26691 INFO – – VIDEO_SUBMIT – Submitted 1 videos to videocache scheduler. –
    09/Aug/2014:18:35:45 26691 INFO 192.168.154.102 YOUTUBE URL_HIT orPQsEaCwok http://www.youtube.com/watch?v=orPQsEaCwok&spf=navigate
    09/Aug/2014:18:35:45 26691 INFO – – VIDEO_SUBMIT – Submitted 1 videos to videocache scheduler. –
    09/Aug/2014:18:38:17 26691 INFO 192.168.154.102 YOUTUBE URL_HIT UqVt04b3Xw8 http://www.youtube.com/watch?v=UqVt04b3Xw8&spf=navigate
    09/Aug/2014:18:38:19 26691 INFO – – VIDEO_SUBMIT – Submitted 1 videos to videocache scheduler. –

    scheduler.log

    09/Aug/2014:18:23:32 26583 INFO – BREAKCOM CACHE_THREAD_START 5cec9c5b-c7ef-4b3c-8ff5-e22a06c428de-thumbnail.mp 4 Starting cache thread. –
    09/Aug/2014:18:23:35 26583 INFO – BREAKCOM VIDEO_CACHED 5cec9c5b-c7ef-4b3c-8ff5-e22a06c428de-thumbnail.mp4 Vide o was cached successfully. 695834 –
    09/Aug/2014:18:23:37 26583 INFO – BREAKCOM CACHE_THREAD_REMOVE 5cec9c5b-c7ef-4b3c-8ff5-e22a06c428de-thumbnail.m p4 Cache thread completed. Removing from active list. –
    09/Aug/2014:18:23:37 26583 INFO – BREAKCOM CACHE_THREAD_START 50-thumbnail.mp4 Starting cache thread. –
    09/Aug/2014:18:23:39 26583 INFO – BREAKCOM VIDEO_CACHED 50-thumbnail.mp4 Video was cached successfully. 689434

    Like

    Comment by Mohamed Musthafa — August 9, 2014 @ 6:45 PM

  60. Hi, dear Syed Jahanzaib,
    I need such script for CentOS OS.
    Could you please help me on this issue?
    Thanks in advance!

    Like

    Comment by Ramin — November 6, 2014 @ 12:13 PM

  61. […] Automated Installation Script for Squid 2.7 Stable 9 with … – Jan 05, 2014 · Following is an automated script to install SQUID 2.7 Stable 9 for UBUNTU with aggressive contents & few video web sites video caching support as …… […]

    Like

    Pingback by Fix Squid Error No Running Copy Ubuntu Windows XP, Vista, 7, 8 [Solved] — November 20, 2014 @ 5:33 AM

  62. Is it possible to put it as a gateway that cache youtube videos?

    Like

    Comment by jacknkh — December 2, 2014 @ 2:24 PM

    • Yes you can also make squid in bridge mode so that it can transparently intercept all or specific request and cache them, but Youtube is now shifted on HTTPs/SSL which is officially not cache-able.

      Liked by 1 person

      Comment by Syed Jahanzaib / Pinochio~:) — December 3, 2014 @ 8:09 AM

      • Thank you for your reply.

        Like

        Comment by jacknkh — December 9, 2014 @ 10:36 AM

  63. is this script still working, as i cannot connect?

    Like

    Comment by alex — October 19, 2018 @ 6:39 PM


RSS feed for comments on this post. TrackBack URI

Leave a comment