废话不说,开始
``` apt-get install dpkg-dev mkdir squiddeb cd squiddeb apt-get source squid3 ll ``` ``` total 3368 drwxr-xr-x 3 root root 4096 Nov 30 21:38 ./ drwx------ 5 root root 4096 Nov 30 21:34 ../ drwxr-xr-x 19 root root 4096 Nov 30 21:38 squid3-3.1.19/ -rw-r--r-- 1 root root 24909 Jan 31 2013 squid3_3.1.19-1ubuntu3.12.04.2.debian.tar.gz -rw-r--r-- 1 root root 1912 Jan 31 2013 squid3_3.1.19-1ubuntu3.12.04.2.dsc -rw-r--r-- 1 root root 3403110 Feb 22 2012 squid3_3.1.19.orig.tar.gz ``` ``` mkdir download mv *.dsc download/ mv *.gz download/ ll ``` ``` drwxr-xr-x 3 root root 4096 Nov 30 21:38 ./ drwx------ 5 root root 4096 Nov 30 21:34 ../ drwxr-xr-x 19 root root 4096 Nov 30 21:38 squid3-3.1.19/ ``` ``` cd squid3-3.1.19/ ll ``` ``` total 1832 drwxr-xr-x 19 root root 4096 Nov 30 21:38 ./ drwxr-xr-x 3 root root 4096 Nov 30 21:38 ../ -rw-r--r-- 1 root root 4751 Feb 5 2012 acinclude.m4 -rw-r--r-- 1 root root 353646 Feb 5 2012 aclocal.m4 -rwxr-xr-x 1 root root 4564 Feb 5 2012 bootstrap.sh* drwxr-xr-x 2 root root 4096 Nov 30 21:38 cfgaux/ -rw-r--r-- 1 root root 213203 Feb 5 2012 ChangeLog drwxr-xr-x 3 root root 4096 Nov 30 21:38 compat/ -rwxr-xr-x 1 root root 881914 Feb 5 2012 configure* -rw-r--r-- 1 root root 126465 Feb 5 2012 configure.ac drwxr-xr-x 3 root root 4096 Nov 30 21:38 contrib/ -rw-r--r-- 1 root root 7819 Feb 5 2012 CONTRIBUTORS -rw-r--r-- 1 root root 17989 Feb 5 2012 COPYING -rw-r--r-- 1 root root 1015 Feb 5 2012 COPYRIGHT -rw-r--r-- 1 root root 17320 Feb 5 2012 CREDITS drwxr-xr-x 4 root root 4096 Jan 29 2013 debian/ drwxr-xr-x 2 root root 4096 Nov 30 21:38 doc/ drwxr-xr-x 46 root root 4096 Nov 30 21:38 errors/ drwxr-xr-x 7 root root 4096 Nov 30 21:38 helpers/ drwxr-xr-x 2 root root 4096 Nov 30 21:38 icons/ drwxr-xr-x 2 root root 4096 Nov 30 21:38 include/ -rw-r--r-- 1 root root 523 Feb 5 2012 INSTALL drwxr-xr-x 4 root root 4096 Nov 30 21:38 lib/ drwxr-xr-x 6 root root 4096 Nov 30 21:38 libltdl/ -rw-r--r-- 1 root root 1784 Feb 5 2012 Makefile.am -rw-r--r-- 1 root root 26632 Feb 5 2012 Makefile.in drwxr-xr-x 8 root root 4096 Nov 30 21:38 .pc/ -rw-r--r-- 1 root root 3428 Feb 5 2012 QUICKSTART -rw-r--r-- 1 root root 1234 Feb 5 2012 README -rw-r--r-- 1 root root 82271 Feb 5 2012 RELEASENOTES.html drwxr-xr-x 2 root root 4096 Nov 30 21:38 scripts/ drwxr-xr-x 2 root root 4096 Nov 30 21:38 snmplib/ -rw-r--r-- 1 root root 2970 Feb 5 2012 SPONSORS drwxr-xr-x 15 root root 12288 Nov 30 21:38 src/ drwxr-xr-x 2 root root 4096 Nov 30 21:38 test-suite/ drwxr-xr-x 2 root root 4096 Nov 30 21:38 tools/ ``` ``` vim debian/rules #修改需要重新编译的部分 ``` ``` --enable-async-io=8 => --enable-async-io=50 ``` ``` ./configure ``` ``` apt-get build-dep squid3 apt-get install devscripts debuild -us -uc -b ``` ``` cd .. ll ``` ``` total 8704 drwxr-xr-x 4 root root 4096 Nov 30 22:03 ./ drwx------ 5 root root 4096 Nov 30 21:45 ../ drwxr-xr-x 2 root root 4096 Nov 30 21:54 download/ -rw-r--r-- 1 root root 90354 Nov 30 22:03 squid_3.1.19-1ubuntu3.12.04.2_amd64.deb drwxr-xr-x 19 root root 4096 Nov 30 21:57 squid3-3.1.19/ -rw-r--r-- 1 root root 711642 Nov 30 22:03 squid3_3.1.19-1ubuntu3.12.04.2_amd64.build -rw-r--r-- 1 root root 3557 Nov 30 22:03 squid3_3.1.19-1ubuntu3.12.04.2_amd64.changes -rw-r--r-- 1 root root 1619576 Nov 30 22:03 squid3_3.1.19-1ubuntu3.12.04.2_amd64.deb -rw-r--r-- 1 root root 204398 Nov 30 22:03 squid3-common_3.1.19-1ubuntu3.12.04.2_all.deb -rw-r--r-- 1 root root 5914328 Nov 30 22:03 squid3-dbg_3.1.19-1ubuntu3.12.04.2_amd64.deb -rw-r--r-- 1 root root 124246 Nov 30 22:03 squid-cgi_3.1.19-1ubuntu3.12.04.2_amd64.deb -rw-r--r-- 1 root root 121566 Nov 30 22:03 squidclient_3.1.19-1ubuntu3.12.04.2_amd64.deb -rw-r--r-- 1 root root 90370 Nov 30 22:03 squid-common_3.1.19-1ubuntu3.12.04.2_all.deb ``` ``` apt-get install squid-langpack dpkg -i squid3_3.1.19-1ubuntu3.12.04.2_amd64.deb squid3-common_3.1.19-1ubuntu3.12.04.2_all.deb ```查看下现在:
``` /usr/sbin/squid3 -v ``` ``` Squid Cache: Version 3.1.19 configure options: '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--libexecdir=${prefix}/lib/squid3' '--srcdir=.' '--disable-maintainer-mode' '--disable-dependency-tracking' '--disable-silent-rules' '--datadir=/usr/share/squid3' '--sysconfdir=/etc/squid3' '--mandir=/usr/share/man' '--with-cppunit-basedir=/usr' '--enable-inline' '--enable-async-io=50' '--enable-storeio=ufs,aufs,diskd' '--enable-removal-policies=lru,heap' '--enable-delay-pools' '--enable-cache-digests' '--enable-underscores' '--enable-icap-client' '--enable-follow-x-forwarded-for' '--enable-auth=basic,digest,ntlm,negotiate' '--enable-basic-auth-helpers=LDAP,MSNT,NCSA,PAM,SASL,SMB,YP,DB,POP3,getpwnam,squid_radius_auth,multi-domain-NTLM' '--enable-ntlm-auth-helpers=smb_lm,' '--enable-digest-auth-helpers=ldap,password' '--enable-negotiate-auth-helpers=squid_kerb_auth' '--enable-external-acl-helpers=ip_user,ldap_group,session,unix_group,wbinfo_group' '--enable-arp-acl' '--enable-esi' '--enable-zph-qos' '--enable-wccpv2' '--disable-translation' '--with-logdir=/var/log/squid3' '--with-pidfile=/var/run/squid3.pid' '--with-filedescriptors=65536' '--with-large-files' '--with-default-user=proxy' '--enable-linux-netfilter' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security' 'LDFLAGS=-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security' --with-squid=/root/squiddeb/squid3-3.1.19 ```重启:
``` /etc/init.d/squid3 restart ```SQUID