-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-ss-tproxy.temp.sh
135 lines (123 loc) · 4.15 KB
/
install-ss-tproxy.temp.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/sh
#
# Script for automatic setup of an SS-TPROXY server on CentOS 7.3 Minimal.
#
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
exiterr() { echo "Error: $1" >&2; exit 1; }
exiterr2() { exiterr "'yum install' failed."; }
bigecho() { echo; echo -e "\033[36m $1 \033[0m"; }
# Disable FireWall
bigecho "Disable Firewall..."
systemctl stop firewalld.service
systemctl disable firewalld.service
# Install Lib
bigecho "Install Library, Pleast wait..."
rpm --rebuilddb && yum -y install sysvinit-tools dnsmasq git gettext gcc autoconf libtool make asciidoc xmlto c-ares-devel libev-devel \
openssl-devel net-tools curl ipset iproute perl wget gcc bind-utils vim || exiterr2
# Install haveged
if ! type haveged 2>/dev/null; then
bigecho "Install Haveged, Pleast wait..."
HAVEGED_VER=1.9.1-1
HAVEGED_URL="http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/haveged-$HAVEGED_VER.el7.x86_64.rpm"
yum -y install "$HAVEGED_URL" || exiterr2
systemctl start haveged
systemctl enable haveged
fi
# Install pdnsd
if ! type pdnsd 2>/dev/null; then
bigecho "Install Pdnsd, Pleast wait..."
PDNSD_VER=1.2.9a
PDNSD_URL="http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-$PDNSD_VER-par_sl6.x86_64.rpm"
yum -y install "$PDNSD_URL" || exiterr2
fi
# Build aclocal-1.15, it's needed by dnsforwarder
if ! type aclocal-1.15 2>/dev/null; then
bigecho "Build aclocal-1.15, Pleast wait..."
AUTOMAKE_VER=1.15
AUTOMAKE_FILE="automake-$AUTOMAKE_VER"
AUTOMAKE_URL="https://ftp.gnu.org/gnu/automake/$AUTOMAKE_FILE.tar.gz"
if ! wget --no-check-certificate -O $AUTOMAKE_FILE.tar.gz $AUTOMAKE_URL; then
bigecho "Failed to download file!"
exit 1
fi
tar xf $AUTOMAKE_FILE.tar.gz
pushd $AUTOMAKE_FILE
./configure
make && make install
popd
fi
# Build dnsforwarder
if ! type dnsforwarder 2>/dev/null; then
bigecho "Build dnsforwarder, Pleast wait..."
git clone https://github.com/holmium/dnsforwarder.git
pushd dnsforwarder
./configure --enable-downloader=no
make && make install
popd
fi
# Build chinadns
if ! type chinadns 2>/dev/null; then
bigecho "Build chinadns, Pleast wait..."
CHINADNS_VER=1.3.2
CHINADNS_FILE="chinadns-$CHINADNS_VER"
CHINADNS_URL="https://github.com/shadowsocks/ChinaDNS/releases/download/$CHINADNS_VER/$CHINADNS_FILE.tar.gz"
if ! wget --no-check-certificate -O $CHINADNS_FILE.tar.gz $CHINADNS_URL; then
bigecho "Failed to download file!"
exit 1
fi
tar xf $CHINADNS_FILE.tar.gz
pushd $CHINADNS_FILE
./configure
make && make install
popd
fi
# Build Libsodium
if [ ! -f "/usr/lib/libsodium.so" ]; then
bigecho "Build Libsodium, Pleast wait..."
LIBSODIUM_VER=1.0.18
LIBSODIUM_FILE="libsodium-$LIBSODIUM_VER"
LIBSODIUM_URL="https://download.libsodium.org/libsodium/releases/$LIBSODIUM_FILE.tar.gz"
if ! wget --no-check-certificate -O $LIBSODIUM_FILE.tar.gz $LIBSODIUM_URL; then
bigecho "Failed to download file!"
exit 1
fi
tar xf $LIBSODIUM_FILE.tar.gz
pushd $LIBSODIUM_FILE
./configure --prefix=/usr && make
make install
popd
ldconfig
fi
# Build MbedTLS
if [ ! -f "/usr/lib/libmbedtls.so" ]; then
bigecho "Build MbedTLS, Pleast wait..."
MBEDTLS_VER=2.16.2
MBEDTLS_FILE="mbedtls-$MBEDTLS_VER"
MBEDTLS_URL="https://tls.mbed.org/code/releases/$MBEDTLS_FILE-gpl.tgz"
if ! wget --no-check-certificate -O $MBEDTLS_FILE-gpl.tgz $MBEDTLS_URL; then
bigecho "Failed to download file!"
exit 1
fi
tar xf $MBEDTLS_FILE-gpl.tgz
pushd $MBEDTLS_FILE
make SHARED=1 CFLAGS=-fPIC
make DESTDIR=/usr install
popd
ldconfig
fi
#Build shadowsocksr-libev
if ! type ssr-redir 2>/dev/null; then
bigecho "Build shadowsocksr-libev, Pleast wait..."
git clone https://github.com/shadowsocksr-backup/shadowsocksr-libev.git
pushd shadowsocksr-libev
./configure --prefix=/usr/local/ssr-libev
make && make install
popd
pushd /usr/local/ssr-libev/bin
mv ss-redir ssr-redir
mv ss-local ssr-local
ln -sf ssr-local ssr-tunnel
mv ssr-* /usr/local/bin/
popd
rm -fr /usr/local/ssr-libev
fi