Last active
August 23, 2020 03:47
-
-
Save backroot/b8d312c3acfa9d099da2d3add229ea0d to your computer and use it in GitHub Desktop.
Setup Squid for Raspberry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Setup for squid cache server (proxy server) | |
if [ ! $1 ]; then | |
echo "not args." | |
exit 1 | |
fi | |
sudo apt update | |
sudo apt-get install squid unzip -y | |
if [ ! -f /etc/squid/squid.conf.bak ]; then | |
echo "backup to /etc/squid/squid.conf.bak" | |
sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.bak | |
fi | |
sudo perl -0pi -e "s;#acl\slocalnet.*;acl localnet src $1;mi" /etc/squid/squid.conf | |
sudo perl -0pi -e "s/#http_access\sallow\slocalnet/http_access allow localnet/mi" /etc/squid/squid.conf | |
sudo perl -0pi -e "s/http_access\sallow\slocalhost/#http_access allow localhost/mi" /etc/squid/squid.conf | |
sudo systemctl restart squid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment