Created
October 27, 2022 15:21
-
-
Save betillogalvanfbc/18002a53947ac050a196be386f78e6d6 to your computer and use it in GitHub Desktop.
installersquid.sh
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 | |
############################################################ | |
# Squid Proxy Installer | |
# Author: Yujin Boby | |
# Email: [email protected] | |
# Github: https://github.com/serverok/squid-proxy-installer/ | |
# Web: https://serverok.in/squid | |
############################################################ | |
# For paid support, contact | |
# https://serverok.in/contact | |
############################################################ | |
if [ `whoami` != root ]; then | |
echo "ERROR: You need to run the script as user root or add sudo before command." | |
exit 1 | |
fi | |
/usr/bin/wget --no-check-certificate -O /usr/local/bin/sok-find-os https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/sok-find-os.sh > /dev/null 2>&1 | |
chmod 755 /usr/local/bin/sok-find-os | |
/usr/bin/wget --no-check-certificate -O /usr/local/bin/squid-uninstall https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid-uninstall.sh > /dev/null 2>&1 | |
chmod 755 /usr/local/bin/squid-uninstall | |
/usr/bin/wget --no-check-certificate -O /usr/local/bin/squid-add-user https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid-add-user.sh > /dev/null 2>&1 | |
chmod 755 /usr/local/bin/squid-add-user | |
if [[ -d /etc/squid/ || -d /etc/squid3/ ]]; then | |
echo "Squid Proxy already installed. If you want to reinstall, first uninstall squid proxy by running command: squid-uninstall" | |
exit 1 | |
fi | |
if cat /etc/os-release | grep PRETTY_NAME | grep "Ubuntu 20.04"; then | |
/usr/bin/apt update | |
/usr/bin/apt -y install apache2-utils squid3 | |
touch /etc/squid/passwd | |
/bin/rm -f /etc/squid/squid.conf | |
/usr/bin/touch /etc/squid/blacklist.acl | |
/usr/bin/wget --no-check-certificate -O /etc/squid/squid.conf https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid.conf | |
if [ -f /sbin/iptables ]; then | |
/sbin/iptables -I INPUT -p tcp --dport 3128 -j ACCEPT | |
/sbin/iptables-save | |
fi | |
service squid restart | |
systemctl enable squid | |
elif cat /etc/os-release | grep PRETTY_NAME | grep "Ubuntu 18.04"; then | |
/usr/bin/apt update | |
/usr/bin/apt -y install apache2-utils squid3 | |
touch /etc/squid/passwd | |
/bin/rm -f /etc/squid/squid.conf | |
/usr/bin/touch /etc/squid/blacklist.acl | |
/usr/bin/wget --no-check-certificate -O /etc/squid/squid.conf https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid.conf | |
/sbin/iptables -I INPUT -p tcp --dport 3128 -j ACCEPT | |
/sbin/iptables-save | |
service squid restart | |
systemctl enable squid | |
elif cat /etc/os-release | grep PRETTY_NAME | grep "Ubuntu 16.04"; then | |
/usr/bin/apt update | |
/usr/bin/apt -y install apache2-utils squid3 | |
touch /etc/squid/passwd | |
/bin/rm -f /etc/squid/squid.conf | |
/usr/bin/touch /etc/squid/blacklist.acl | |
/usr/bin/wget --no-check-certificate -O /etc/squid/squid.conf https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid.conf | |
/sbin/iptables -I INPUT -p tcp --dport 3128 -j ACCEPT | |
/sbin/iptables-save | |
service squid restart | |
update-rc.d squid defaults | |
elif cat /etc/*release | grep DISTRIB_DESCRIPTION | grep "Ubuntu 14.04"; then | |
/usr/bin/apt update | |
/usr/bin/apt -y install apache2-utils squid3 | |
touch /etc/squid3/passwd | |
/bin/rm -f /etc/squid3/squid.conf | |
/usr/bin/touch /etc/squid3/blacklist.acl | |
/usr/bin/wget --no-check-certificate -O /etc/squid3/squid.conf https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid.conf | |
/sbin/iptables -I INPUT -p tcp --dport 3128 -j ACCEPT | |
/sbin/iptables-save | |
service squid3 restart | |
ln -s /etc/squid3 /etc/squid | |
#update-rc.d squid3 defaults | |
ln -s /etc/squid3 /etc/squid | |
elif cat /etc/os-release | grep PRETTY_NAME | grep "jessie"; then | |
# OS = Debian 8 | |
/bin/rm -rf /etc/squid | |
/usr/bin/apt update | |
/usr/bin/apt -y install apache2-utils squid3 | |
touch /etc/squid3/passwd | |
/bin/rm -f /etc/squid3/squid.conf | |
/usr/bin/touch /etc/squid3/blacklist.acl | |
/usr/bin/wget --no-check-certificate -O /etc/squid3/squid.conf https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid.conf | |
/sbin/iptables -I INPUT -p tcp --dport 3128 -j ACCEPT | |
/sbin/iptables-save | |
service squid3 restart | |
update-rc.d squid3 defaults | |
ln -s /etc/squid3 /etc/squid | |
elif cat /etc/os-release | grep PRETTY_NAME | grep "stretch"; then | |
# OS = Debian 9 | |
/bin/rm -rf /etc/squid | |
/usr/bin/apt update | |
/usr/bin/apt -y install apache2-utils squid | |
touch /etc/squid/passwd | |
/bin/rm -f /etc/squid/squid.conf | |
/usr/bin/touch /etc/squid/blacklist.acl | |
/usr/bin/wget --no-check-certificate -O /etc/squid/squid.conf https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid.conf | |
/sbin/iptables -I INPUT -p tcp --dport 3128 -j ACCEPT | |
/sbin/iptables-save | |
systemctl enable squid | |
systemctl restart squid | |
elif cat /etc/os-release | grep PRETTY_NAME | grep "buster"; then | |
# OS = Debian 10 | |
/bin/rm -rf /etc/squid | |
/usr/bin/apt update | |
/usr/bin/apt -y install apache2-utils squid | |
touch /etc/squid/passwd | |
/bin/rm -f /etc/squid/squid.conf | |
/usr/bin/touch /etc/squid/blacklist.acl | |
/usr/bin/wget --no-check-certificate -O /etc/squid/squid.conf https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid.conf | |
/sbin/iptables -I INPUT -p tcp --dport 3128 -j ACCEPT | |
/sbin/iptables-save | |
systemctl enable squid | |
systemctl restart squid | |
elif cat /etc/os-release | grep PRETTY_NAME | grep "CentOS Linux 7"; then | |
yum install squid httpd-tools -y | |
/bin/rm -f /etc/squid/squid.conf | |
/usr/bin/touch /etc/squid/blacklist.acl | |
/usr/bin/wget --no-check-certificate -O /etc/squid/squid.conf https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/conf/squid-centos7.conf | |
systemctl enable squid | |
systemctl restart squid | |
firewall-cmd --zone=public --permanent --add-port=3128/tcp | |
firewall-cmd --reload | |
elif cat /etc/os-release | grep PRETTY_NAME | grep "CentOS Linux 8"; then | |
yum install squid httpd-tools -y | |
/bin/rm -f /etc/squid/squid.conf | |
/usr/bin/touch /etc/squid/blacklist.acl | |
/usr/bin/wget --no-check-certificate -O /etc/squid/squid.conf https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/conf/squid-centos7.conf | |
systemctl enable squid | |
systemctl restart squid | |
firewall-cmd --zone=public --permanent --add-port=3128/tcp | |
firewall-cmd --reload | |
else | |
echo "OS NOT SUPPORTED.\n" | |
echo "Contact https://serverok.in/contact to add support for your os." | |
exit 1; | |
fi | |
echo | |
echo "Thank you for using ServerOk.in Squid Proxy Installer." | |
echo "To create a proxy user, run command: squid-add-user" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment