Last active
January 25, 2022 08:50
-
-
Save devymex/2f0a53c19356c4e9bedd1b8b145fb210 to your computer and use it in GitHub Desktop.
Install Shadowsocks Server
This file contains 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 | |
set -e | |
if [[ $# -lt 3 ]]; then | |
echo "Usage: "$0" <PROXY_PORT> <PROXY_PSWD>" | |
exit 0 | |
fi | |
apt update | |
apt -y upgrade | |
apt -y install --no-install-recommends git gettext build-essential \ | |
autoconf libtool libpcre3-dev asciidoc xmlto libev-dev libc-ares-dev \ | |
automake libmbedtls-dev libsodium-dev libssl-dev autoconf libtool pkg-config | |
rm -rf shadowsocks-libev | |
git clone https://github.com/shadowsocks/shadowsocks-libev.git | |
cd shadowsocks-libev | |
git submodule update --init --recursive | |
./autogen.sh && ./configure && make | |
make install | |
cd .. | |
rm -rf shadowsocks-obfs | |
git clone https://github.com/shadowsocks/simple-obfs.git | |
cd simple-obfs | |
git submodule update --init --recursive | |
./autogen.sh && ./configure && make | |
make install | |
cd .. | |
setcap cap_net_bind_service+ep /usr/local/bin/obfs-server | |
SP=$1 | |
PW=$2 | |
mkdir -p /etc/shadowsocks | |
printf "{\n\"server\":\"0.0.0.0\",\n\"server_port\":$SP,\n\"password\":\"$PW\",\n\ | |
\"method\":\"chacha20-ietf-poly1305\",\n\"plugin\":\"obfs-server\",\n\ | |
\"plugin_opts\":\"obfs=http\"\n}"\ | |
> /etc/shadowsocks/server.json | |
printf "[Unit]\nDescription=Shadowsocks-libev Default Local Service\n\ | |
Documentation=man:shadowsocks-libev(8)\nAfter=network.target\n\ | |
[Service]\nType=simple\nUser=root\nGroup=root\nLimitNOFILE=32768\n\ | |
ExecStart=/usr/local/bin/ss-server -c /etc/shadowsocks/server.json\n\ | |
CapabilityBoundingSet=CAP_NET_BIND_SERVICE\n[Install]\n\ | |
WantedBy=multi-user.target\n" > /etc/systemd/system/ss-server.service | |
systemctl daemon-reload | |
systemctl start ss-server | |
systemctl enable ss-server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment