Skip to content

Instantly share code, notes, and snippets.

@lbp0200
Last active July 13, 2017 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbp0200/85569f03c66b7958605a8e5da18ada66 to your computer and use it in GitHub Desktop.
Save lbp0200/85569f03c66b7958605a8e5da18ada66 to your computer and use it in GitHub Desktop.
vultr startup script
apt update
#开启bbr
modprobe tcp_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
#安装必要软件
apt install -y git python supervisor pwgen curl jq
cd /opt
#下载ssr
git clone https://github.com/shadowsocksr/shadowsocksr.git
#生成密码
pwd=`pwgen 15 1`
server_ip=`curl -s http://ipinfo.io/ | jq -r '.ip'`
#写入配置文件
echo "{
"server": "0.0.0.0",
"server_ipv6": "::",
"server_port": 80,
"local_address": "127.0.0.1",
"local_port": 1080,
"password": "$pwd",
"method": "aes-128-ctr",
"protocol": "auth_aes128_md5",
"protocol_param": "",
"obfs": "tls1.2_ticket_auth",
"obfs_param": "",
"speed_limit_per_con": 0,
"speed_limit_per_user": 0,
"additional_ports" : {},
"timeout": 120,
"udp_timeout": 60,
"dns_ipv6": false,
"connect_verbose_info": 0,
"redirect": "127.0.0.1:8080",
"fast_open": true
}" > /opt/shadowsocksr/config.json
#创建ssr守护配置,保证ssr一直运行
echo "[program:shadowsocksR]
command=python2 /opt/shadowsocksr/shadowsocks/server.py -c /opt/shadowsocksr/config.json
autostart=true
autorestart=true
user=root" > /etc/supervisor/conf.d/ssr.conf
#启动ssr
supervisorctl reload
#获得ssr连接信息
echo "服务器IP:$server_ip
端口:80
密码:$pwd
加密:aes-128-ctr
协议:auth_aes128_md5
混淆:tls1.2_ticket_auth
" > /opt/ssr.info
echo "alias hi=cat /opt/ssr.info"
#重启服务器,让bbr生效
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment