-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwizards.sh
84 lines (71 loc) · 1.87 KB
/
wizards.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
#!/bin/bash
set -e
cd /tmp
apt-get -y update
apt-get -y upgrade
apt-get -y install supervisor
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.4/linux-image-4.9.4-040904-generic_4.9.4-040904.201701150831_amd64.deb
dpkg -i linux-image-4.9.*.deb
update-grub
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
read -r -p "Is your network high-latency or low-latency? [H/l]: " response
case $response in
[lL]*)
modprobe tcp_htcp
;;
*)
modprobe tcp_hybla
;;
esac
wget https://github.com/abc950309/ShadowsocksWizards/raw/master/download/shadowsocks-server.gz
gzip -d shadowsocks-server.gz
mv shadowsocks-server /usr/bin/shadowsocks-server
chown root:root /usr/bin/shadowsocks-server
chmod 755 /usr/bin/shadowsocks-server
if [ ! -d /etc/shadowsocks ];then
mkdir /etc/shadowsocks
fi
cat > /etc/shadowsocks/config.json<<-EOF
{
"server": "0.0.0.0",
"server_port": 443,
"local_port": 1080,
"password": "password",
"method": "aes-128-cfb-auth",
"timeout": 600
}
EOF
read -r -p "Do you want to change the default config? [Y/n]: " response
case $response in
[nN]*)
;;
*)
vim /etc/shadowsocks/config.json
;;
esac
cat > /etc/supervisor/conf.d/shadowsocks.conf<<-EOF
[program:shadowsocks]
command=shadowsocks-server
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8,LC_LANG=en_US.UTF-8
autorstart=true
directory=/etc/shadowsocks
autorestart=true
startsecs=10
startretries=36
redirect_stderr=true
stdout_logfile=/var/log/shadowsocks-server.out.log
stderr_logfile=/var/log/shadowsocks-server.err.log
EOF
systemctl enable supervisor
echo "3 4 * * 1 root reboot" >> /etc/crontab
apt-get -y autoremove
apt-get -y autoclean
read -r -p "Do you want to reboot now? [Y/n]: " response
case $response in
[nN]*)
;;
*)
reboot
;;
esac