-
-
Save jiahut/7e8196d981231e87a87052670dbe55bb to your computer and use it in GitHub Desktop.
How to Setup shadowsocks-rust Server with v2ray-plugin or xray-plugin on Any Linux Host
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
#!/usr/bin/env bash | |
# https://github.com/shadowsocks/shadowsocks-rust/releases | |
export SSVERSION=v1.15.4 | |
export SSPORT=143 | |
export SSPASSWORD="CHANGEME" | |
export SSARCHIVE="shadowsocks-${SSVERSION}.x86_64-unknown-linux-gnu.tar.xz" | |
#export SSARCHIVE="shadowsocks-${SSVERSION}.aarch64-unknown-linux-gnu.tar.xz" | |
export PREFIX=/usr/local/bin | |
#export PREFIX=${HOME}/.local/bin | |
export CONFIGDIR=/etc | |
wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/${SSVERSION}/${SSARCHIVE} -O ${SSARCHIVE} | |
tar -xvf ${SSARCHIVE} -C ${PREFIX} | |
# https://github.com/shadowsocks/v2ray-plugin/releases | |
export V2RAY_VERSION=v1.3.2 | |
export V2RAY_ARCHIVE="v2ray-plugin-linux-amd64-${V2RAY_VERSION}.tar.gz" | |
wget "https://github.com/shadowsocks/v2ray-plugin/releases/download/${V2RAY_VERSION}/${V2RAY_ARCHIVE}" -O ${V2RAY_ARCHIVE} | |
tar -xvf ${V2RAY_ARCHIVE} -C ${PREFIX} | |
mv ${PREFIX}/v2ray-plugin_linux_amd64 ${PREFIX}/v2ray-plugin | |
# https://github.com/teddysun/xray-plugin/releases | |
export XRAY_VERSION=v1.8.3 | |
export XRAY_ARCHIVE="xray-plugin-linux-amd64-${XRAY_VERSION}.tar.gz" | |
wget "https://github.com/teddysun/xray-plugin/releases/download/${XRAY_VERSION}/${XRAY_ARCHIVE}" -O ${XRAY_ARCHIVE} | |
tar -xvf ${XRAY_ARCHIVE} -C ${PREFIX} | |
mv ${PREFIX}/xray-plugin_linux_amd64 ${PREFIX}/xray-plugin | |
### server: | |
cat <<EOF > /etc/ssserver.json | |
{ | |
"server": "0.0.0.0", | |
"server_port": ${SSPORT}, | |
"password": "${SSPASSWORD}", | |
"method": "chacha20-ietf-poly1305", | |
"fast_open": true, | |
"timeout": 300, | |
"reuse_port": true | |
// ,"plugin": "v2ray-plugin" | |
// ,"plugin": "xray-plugin" | |
// ,"plugin_opts": "server;tls;host=my.host;path=/wss;cert=/etc/letsencrypt/live/my.host/fullchain.pem;key=/etc/letsencrypt/live/my.host/privkey.pem" | |
} | |
EOF | |
cat <<EOF > /etc/systemd/system/ssserver.service | |
[Unit] | |
Description=shadowsocks-rust server | |
After=network-online.target | |
[Service] | |
Type=simple | |
LimitNOFILE=32768 | |
ExecStart=${PREFIX}/ssserver -c /etc/ssserver.json | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
systemctl daemon-reload | |
systemctl enable ssserver | |
systemctl restart ssserver | |
systemctl status ssserver | |
# OPTIONAL: | |
# systemctl disable --now ufw | |
# systemctl disable --now firewalld | |
# systemctl mask --now firewalld |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment