How to Install and configure Squid proxy in one click

Proxies and VPNs at the current stage of Internet development have become a necessary tool for almost every user. Improving security, bypassing website blocking and restrictions are some of the main advantages of using proxy services. Someone prefers to buy ready-made solutions, while someone implements their own due to the wide variety of opensource products.

One such product is a proxy server called Squid:
Squid is a caching and forwarding HTTP web proxy. It has a wide variety of uses, including speeding up a web server by caching repeated requests, caching web, DNS and other computer network lookups for a group of people sharing network resources, and aiding security by filtering traffic.

Despite the wide functionality and a lot of settings - one of its advantages is the ease of setup and installation. We have prepared a script that will allow even a novice to install Squid on a VPS server and get started as quickly as possible.

So, for starters, we need a Centos 7-based VPS server and the script below:

yum install -y squid
cat > /etc/squid/squid.conf << EOL auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/internet_users auth_param basic realm proxy acl authenticated proxy_auth REQUIRED http_access allow authenticated http_port $squid_port EOL PASSWORD=$(date +%s | sha256sum | base64 | head -c 32 ; echo -n) touch /etc/squid/internet_users htpasswd -b /etc/squid/internet_users $proxy_user $PASSWORD echo "$proxy_user $PASSWORD" > /root/proxyusers
service squid restart
cat << EOL
http proxy:
ip: wget -qO-
port: $squid_port
user: $proxy_user
password: $PASSWORD
Before you start, you can edit the first two lines:
proxy_user = myuser <- enter here any username, for example vasya
squid_port = 39128 <- and here the port, any, to your taste
You can not edit these parameters, the script will work without your changes.
We copy the script above, paste it into the console and wait for the installation and configuration of Squid to complete. After completion, you will get a convenient output of the form:
http proxy:
ip: x.x.x.x
port: 22412
user: username
password: DSGSDJ#(@IEWJKF215 

This data is from a fully-operational Squid server. Now you can insert them into your browser and access the Internet through your own proxy server.