Tutorial - Installing Squid 2.7 in Debian VPS

· 1 min read

This time, I’m gonna write a tutorial for installing squid proxy in a Debian VPS ( BuyVM )

  • Lets install squid in the Debian VPS :
    # apt-get install squid
  • Shutdown squid if it’s running :
    # squid -k shutdown
    or
    # service squid stop
  • Configure the squid.conf located at /etc/squid/squid.conf:
    # nano /etc/squid/squid.conf

    Add the following code at the top of squid.conf :

    auth_param basic program /usr/lib/squid/pam_auth
    auth_param basic children 5
    auth_param basic realm Squid proxy-caching web server
    auth_param basic credentialsttl 4 hours
    acl password proxy_auth REQUIRED
    http_access allow password
    forwarded_for off
    auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/users_passwd
    acl ncsa_users proxy_auth REQUIRED
    http_access allow ncsa_users

    To change the squid port from default port 3128 to another port, reopen again the /etc/squid/squid.conf, change the http_port from 3128 to another port to secure your squid from unauthorized use, for example :

    http_port 12873

    Save the modified squid.conf  by pressing Ctrl + O, and press Enter
    Exit from nano editor by pressing Ctrl + X

  • Create file users_password for squid security purpose :
    # nano /etc/squid/users_passwd

    Type a character and delete it. And then save the file by pressing Ctrl + O
    Exit from the nano editor by pressing Ctrl + X

  • Now, we will use the function htpasswd from the apache to securing access to our squid server :
    # htpasswd /etc/squid/users_passwd user-for-accessing-squid

    for example :

    # htpasswd /etc/squid/users_passwd userssatu

    Type the password for it.

  • Running the squid :
    # service squid start
  • Now you have a squid program running in your Debian VPS.

If you want to use it, you can use the example configuration at your browser proxy setting :
IP Address : 123.123.123.123  Port : 12873
The IP Address is your VPS IP Address, and the Port is using your squid http_port configuration