System Requirement:
- Processor C2D
- Min 2Gb ram (4Gb Recommended)
- 2 Nic Interface
- Min 80Gb Hard Drive ( 250 or more) depend on your network requirement
- Operating System Required:
- Installed Ubuntu (any version Desktop)
- After installation completed Lucid Server (10.04) set up and I would like to change the mirror from US (or any other country) to the Main Ubuntu Mirror.In a Desktop environment I would select the main mirror like this:
- and Close, wait for updating server list download by Ubuntu 10.04.after update of download server list. Open terminal window and typesudo -ienter your password and logged in as rootNow its time to start installation and setting up Squid
mkdir/tempcd/temptouchinstall.shchmod+xinstall.shnanoinstall.sh- COPY PAST
#!/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 / http://aacable.wordpress.com# Setting Variables . . . [JZ]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 UBUNTUecho -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 ]]; thenechoecho -e "$COL_GREEN Ubuntu is installed with following information fetched. $COL_RESET"lsb_release -asleep 3elseecho -e "$COL_RED Sorry, it seems your Linux Distribution is not UBUNTU . Exiting ...$COL_RESET"exit 1fi# Make sure only root can run our script / Checking if user is root, otherwise exit with error [[Jz]]echoecho -e "$COL_GREEN Verifying if you are logged in with root privileges . . .$COL_RESET" 1>&2FILE="/tmp/out.$$"GREP="/bin/grep"if [ "$(id -u)" != "0" ]; thenechoecho -e "$COL_RED This script must be run as root, switch to root now . . .$COL_RESET" 1>&2exit 1fi# Clearing previous download if any in /temp folderechoecho -e "$COL_GREEN Clearing previous downloads if any in /temp folder to avoid duplication$COL_RESET"sleep 3rm -fr /temp/squid.confrm -fr /temp/storeurl.txtrm -fr /temp/storeurl.plrm -fr /temp/squid-2.7.STABLE9*# Checking IF $URL is accessible m if YES then continue further , otherwise EXIT the script with ERROR ! [[ JZ .. . .]]echoecho -e "$COL_GREEN Checking if $URL is accessible in order to proceed further. . .!! $COL_RESET"cd /tempwget -q $URL/squid.conf{if [ ! -f /temp/squid.conf ]; thenechoecho -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 0fi}rm -fr /temp/squid.confsleep 6# Moving further . . .clearecho -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"echoechoecho "1. 32bit Ububtu [If you have 32bit OS]"echo "2. 64bit ubuntu [If you have 64bit OS]"echoecho -n "Choose an option: [1] "read squidchoiceif [ -z "$squidchoice" ]; thensquidchoice="1"ficase $squidchoice in1 ) 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."echoexit;;esac################################################################## [zaib]echoecho -e "$COL_GREEN Updating Ubuntu first . . . !! $COL_RESET"apt-get updateechoechoecho -e "$COL_GREEN Installing required components . . . !! $COL_RESET"sleep 3apt-get -y install gcc build-essential sharutils ccze libzip-dev automake1.9# Clearing OLD data files . . .{if [ -f $SQUID_DIR/squid.conf ]; thenechoechoecho -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.oldelseechoechoecho -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 PIDif [ "$pid" == "" ]; thenechoechoecho -e "$COL_GREEN No SQUID instance found in memory , so it seems we are good to GO !!! $COL_RESET"elseechoecho -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"echoecho -e "$COL_RED KILLING PREVIOUS SQUID INSTANCE by killall -9 squid command !! $COL_RESET"killall -9 squidsleep 3fi# Downloading Squid source package [zaib]echoechoecho -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" ]; thenechoechoecho -e "$COL_RED /temp folder not found, Creating it so all downlaods will be placed here . . . $COL_RESET"mkdir /tempelseechoecho -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 ]; thenrm -fr /temp/squid-2.7.STABLE9+patch.tar.gzfi}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 ]; thenechoechoecho -e "$COL_RED ERROR: SQUID source code package File could not be download or not found in /temp/ !! $COL_RESET"exit 0fi}echoechoecho -e "$COL_GREEN Extracting Squid from tar archive. . . !! $COL_RESET"sleep 3tar zxvf squid-2.7.STABLE9+patch.tar.gzcd squid-2.7.STABLE9mkdir /etc/squidecho -e "$COL_GREEN Executing $squidlabel Compiler which you have selected architecture type in start menu . . . !! $COL_RESET"$squidverechoechoecho -e "$COL_GREEN Executing MAKE and MAKE INSTALL commands . . . !! $COL_RESET"sleep 3makemake installechoechoecho -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" ]; thenechoechoecho -e "$COL_GREEN LOGS folder found. No ned to create, proceeding ruther . . . $COL_RESET"elseechoechoecho -e "$COL_GREEN Creating LOG Folder in /var/log/squid and setting permissions accordingly (to user proxy) $COL_RESET"mkdir /var/log/squidfi}chown proxy:proxy /var/log/squid## ** DOWNLOAD SQUID.CONFechoechoecho -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 ]; thenrm -fr /temp/squid.conffi}cd /tempwget $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 ]; thenechoechoecho -e "$COL_RED ERROR: SQUID.CONF File could not be download or not found in /temp/ !! $COL_RESET"exit 0fi}cp -fr squid.conf $SQUID_DIR## ** DOWNLOAD SQUID.CONFechoechoecho -e "$COL_GREEN Downloading STOREURL.PL file from $URL and copy it to $SQUID_DIR. . . !! $COL_RESET"sleep 3cd /temp{if [ -f /temp/storeurl.txt ]; thenrm -fr /temp/storeurl.txtfi}wget $URL/storeurl.txt{if [ -f /temp/storeurl.pl ]; thenrm -fr /temp/storeurl.plfi}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 ]; thenechoechoecho -e "$COL_RED ERROR: STOREURL.PL File could not be download or not found in /temp/ !! $COL_RESET"exit 0fi}cp -fr storeurl.pl $SQUID_DIRechoechoecho -e "$COL_GREEN Setting EXECUTE permission for storeurl.pl . . . !! $COL_RESET"chmod +x $SQUID_DIR/storeurl.pl# Creating CACHE foldersechoechoecho -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" ]; thenechoechoecho -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_DIRchown proxy:proxy $CACHE_DIRsquid -zchmod 777 -R $CACHE_DIRelseechoecho -e "$COL_RED $CACHE_DIR folder already exists , Clearing it before proceeding. . . $COL_RESET"rm -fr $CACHE_DIR/*chown proxy:proxy $CACHE_DIRecho -e "$COL_GREEN $CACHE_DIR Initializing Cache Directories as per the config . . . $COL_RESET"echosquid -zchmod 777 -R $CACHE_DIRfi}echoechoecho -e "$COL_GREEN Adding squid in /etc/rc.local for auto startup . . . !! $COL_RESET"sed -i '/exit/d' /etc/rc.localsed -i '/[/usr\/sbin\/squid]/d' /etc/rc.localecho /usr/sbin/squid >> /etc/rc.localecho exit 0 >> /etc/rc.localechoecho -e "$COL_GREEN Starting SQUID (and adding 10 seconds Pause for proper initialization). . . !! $COL_RESET"squidsleep 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"#elseps aux |grep squidechoecho -e "$COL_GREEN $squidlabel is Running OK with PID number "$pid", no further action required, EXITING . . .$COL_RESET"echoecho To view squid web access activity log, use commandecho -e "$COL_GREEN tail -f /var/log/squid/access.log $COL_RESET"echo ORecho -e "$COL_GREEN tail -f /var/log/squid/access.log |ccze $COL_RESET"echoecho -e "$COL_GREEN Regard's / Syed Jahanzaib . . . !! $COL_RESET"echo
Now its time to start automated installation script.
1
./install.sh
Select your operating information as per installation script guided for 32bit OS press 1 and 64bit OS press 2.
Wait till installation complete .
Please share your experience and comments in message .
Thanks
No comments:
Post a Comment