-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.sh
94 lines (73 loc) · 1.69 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
# Init
supported=" - Ubuntu 14.04 and 16.04 LTS on i386 and amd64"
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "Execute: sudo /bin/sh install.sh" 1>&2
exit 1
fi
yesno () {
while read line; do
case $line in
y|Y|Yes|YES|yes|yES|yEs|YeS|yeS) return 0
;;
n|N|No|NO|no|nO) return 1
;;
*)
printf "\nPlease enter y or n: "
;;
esac
done
}
# Welcome Message
cat <<EOF
Welcome to the Anonymous Proxy Squid installer
WARNING:
The installation is quite stable and functional when run on a freshly
installed supported Operating System.
The systems currently supported by install.sh are:
EOF
echo "$supported"
cat <<EOF
If your OS is not listed above, this script will fail.
EOF
printf " Continue? (y/n) "
if ! yesno; then
exit 1
fi
# Operating System Update
apt-get update
apt-get upgrade -y
apt-get -f install -y
# Install Packages
apt-get install apache2-utils squid -y
# Disable IPv6
ipv6=$(cat /proc/sys/net/ipv6/conf/all/disable_ipv6)
if [ "$ipv6" != "1" ]
then
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf
sysctl -p
fi
# Go to the Squid main folder
cd /etc/squid/
# Download file from GitHub
mv -i squid.conf squid.conf.bak
wget https://raw.githubusercontent.com/zoilomora/squid/master/squid.conf
# Create cache file
mkdir list
touch list/not-to-cache.conf
# Create password file
touch passwd
chmod o+r passwd
# Create user
printf "New user: "
read line
if [ "$line" != "" ]
then
htpasswd /etc/squid/passwd "$line"
fi
# Restart service
/etc/init.d/squid restart
exit 0