Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "Warning: This script is only tested on ubuntu 18.04 LTS"
- DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
- # Require sudo privilege to setup and install packages
- echo "Turning on BBR..."
- sudo bash -c "modprobe tcp_bbr" &>/dev/null
- sudo bash -c "echo tcp_bbr >> /etc/modules-load.d/modules.conf" &>/dev/null
- sudo bash -c "echo net.core.default_qdisc=fq >> /etc/sysctl.conf" &>/dev/null
- sudo bash -c "echo net.ipv4.tcp_congestion_control=bbr >> /etc/sysctl.conf" &>/dev/null
- sudo sysctl -p &>/dev/null
- echo "Installing shadowsocks..."
- sudo apt-get install -y shadowsocks-libev &>/dev/null
- echo "Creating random password, you can change later"
- PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo '')
- cat > ss.config.json <<EOF
- {
- "password" : "$PASSWORD",
- "timeout" : 1000,
- "server_port" : 8488,
- "method" : "chacha20-ietf-poly1305",
- "local_port" : 1080
- }
- EOF
- echo "Adding shadowsocks to system service..."
- sudo bash -c "cat > /etc/systemd/system/ss.service" <<EOF
- [Unit]
- Description=SS server
- After=network.target
- [Service]
- User=$(whoami)
- Restart=always
- WorkingDirectory=$DIR
- ExecStart=$(which ss-server) -c ss.config.json -u
- [Install]
- WantedBy=multi-user.target
- EOF
- sudo systemctl enable ss
- echo "Installation complete!"
- echo "You can manage ss by 'sudo systemctl status/start/stop/restart ss'"
Add Comment
Please, Sign In to add comment