Install Squid3 and Apache tools.
apt-get install squid3 apache2-utilsWe will use Apache htpasswd to generate a password. If you don’t want to install additional packages, you can use Perl to generate your password.
Back up the current Squid3 settings.
cp /etc/squid3/squid.conf /etc/squid3/squid.conf.bakOpen and replace the content in /etc/squid3/squid.conf with the following:
http_port 3128
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/.passwd
auth_param basic children 1
auth_param basic credentialsttl 1 minute
auth_param basic casesensitive off
acl auth proxy_auth REQUIRED
acl localhost src 127.0.0.0/8
http_access allow auth
http_access allow localhost
http_access deny all
cache deny all
forwarded_for delete
request_header_access Via deny allNotes: The default Squid port is 3128; changed to a different port for improved security.
Create a new user to log in to the Squid3 Server.
htpasswd -c /etc/squid3/.passwd YOUR_USER_NAMEIf you do not have Apache installed, use Perl to implement authentication.
echo -e "YOUR_USERNAMEperl -le 'print crypt("YOUR_PASSWORD","salt")'" > /etc/squid3/.passwdRestart your Squid3 service, and the job is done.
/etc/init.d/squid3 restart