Last active
June 13, 2022 16:35
-
-
Save hasanparasteh/a9fb8cd18d8d651a19d599a728a09222 to your computer and use it in GitHub Desktop.
setups a simple 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 | |
# upgrade ubuntu and install snapd | |
sudo apt update && apt upgrade -y | |
sudo apt install -y snapd | |
sudo snap install shadowsocks-libev | |
# server configurations | |
sudo mkdir -p /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev | |
sudo touch /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/config.json | |
tee -a /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/config.json << END | |
{ | |
"server": "0.0.0.0", | |
"mode":"udp", | |
"server_port":8098, | |
"local_port":1080, | |
"password":"SomeSecurePassword-123", | |
"timeout":300, | |
"method":"chacha20-ietf-poly1305", | |
"nameserver":"9.9.9.9,149.112.112.112" | |
} | |
END | |
# creating a service | |
sudo touch /etc/systemd/system/shadowsocks-libev-server@.service | |
tee -a /etc/systemd/system/shadowsocks-libev-server@.service << END | |
[Unit] | |
Description=Shadowsocks-Libev Custom Server Service for %I | |
Documentation=man:ss-server(1) | |
After=network-online.target | |
[Service] | |
Type=simple | |
ExecStart=/usr/bin/snap run shadowsocks-libev.ss-server -c /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/%i.json | |
[Install] | |
WantedBy=multi-user.target | |
END | |
# enableing service | |
sudo systemctl enable --now shadowsocks-libev-server@config | |
sudo ufw allow 8098 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment