Skip to content

Instantly share code, notes, and snippets.

@bingliang-zh
Created April 26, 2018 06:33
Show Gist options
  • Save bingliang-zh/a820bd768797243c110ce78f1747b956 to your computer and use it in GitHub Desktop.
Save bingliang-zh/a820bd768797243c110ce78f1747b956 to your computer and use it in GitHub Desktop.
deploy ss & bbr on new vultr server boot
#!/bin/sh
# author: bingliang
# date: Apr/26/2018
#
# ------------Usage------------
# go to https://my.vultr.com/ --> Startup Scripts --> Add Startup Script
# --> name: anything as you wish; Type: Boot; Script: copy this script --> Add Script
# when you depoly a new server, select this script on deploy page before click "Deploy Now"
#
# ------------Comments------------
# only password need to be set, default port 8388
# server ip is automatically set by using "hostname -I"
# mine is using rc4-md5 because it is good enough in my eyes
# test on Ubuntu 17.10 x64 on Vultr with shadowsocks-libev version as 3.0.8
# "systemctl enable" seems not working by now, so using "systemctl start" instead
# apt upgrade and autoremove after everything is done, but it takes no harm anyway
PASSWORD="your_password"
SERVER_PORT="8388"
apt update
apt install shadowsocks-libev -y
// using bbr
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
echo -n "{\"server\":\"" >> /etc/shadowsocks-libev/ssconfig.json && echo -n `hostname -I` >> /etc/shadowsocks-libev/ssconfig.json && echo -n "\",\"server_port\":$SERVER_PORT,\"local_address\": \"127.0.0.1\",\"local_port\":1080,\"password\":\"$PASSWORD\",\"timeout\":300,\"method\":\"rc4-md5\",\"fast_open\": false,\"workers\": 1,\"prefer_ipv6\": false}" >> /etc/shadowsocks-libev/ssconfig.json
systemctl start shadowsocks-libev-server@ssconfig
# optional
apt upgrade -y
apt autoremove -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment