Skip to content

Shadowsocks SS一键脚本搭建 + apt一段代码搭建

SS的确用的很少了,但最近搞了个IPLC,不用过墙。搭个SS可能最省事。一键脚本是这位大哥写的。

一键脚本

# just in case
apt install git
# 下载一键脚本
git clone https://github.com/suniceman/ss-fly
# -i 后面的是密码和端口号
ss-fly/ss-fly.sh -i Passw0rd 20600

# 可选,将默认加密方法修改 /windows-v2rayN只认aes-256-gcm
sed -i 's/aes-256-cfb/aes-256-gcm/g' /etc/shadowsocks.json
/etc/init.d/ss-fly restart

然后就好了,对,好了。

如果是OVZ架构的NAT虚拟机,如要安装BBR,可以用这个

我试成功的是这个 https://github.com/tcp-nanqinlang/wiki/wiki/lkl-rinetd

或者这个解释更详细
# 或者直接试 - 一样的
wget https://github.com/tcp-nanqinlang/lkl-rinetd/releases/download/1.1.0/tcp_nanqinlang-rinetd-debianorubuntu.sh && bash tcp_nanqinlang-rinetd-debianorubuntu.sh

有可能需要修改timeout – 配置文件在这

vi /etc/shadowsocks.json
# change timeout to 900 or more
# log file
tail -f /var/log/shadowsocks.log
# 背景命令 /usr/bin/python /usr/local/bin/ssserver -c /etc/shadowsocks.json -d start

管理命令

# 启动:
/etc/init.d/ss-fly start
# 停止:
/etc/init.d/ss-fly stop
# 重启:
/etc/init.d/ss-fly restart
# 状态:
/etc/init.d/ss-fly status

用docker一键安装

SS_FOLDER="/data/docker-shadowsocks-libev"
SS_PORT=10056
SS_PASSWORD="abcde"

mkdir -p ${SS_FOLDER} && cd ${SS_FOLDER}
cat > ${SS_FOLDER}/config.json <<EOF
{
    "server":"0.0.0.0",
    "server_port":${SS_PORT},
    "password":"${SS_PASSWORD}",
    "timeout":600,
    "method":"aes-256-gcm",
    "fast_open":false,
    "nameserver":"8.8.8.8",
    "mode":"tcp_and_udp"
}
EOF

# 如果你想同时开启 simple-obfs,那么配置文件范例如下:
cat > ${SS_FOLDER}/config.json <<EOF
{
    "server":"0.0.0.0",
    "server_port":${SS_PORT},
    "password":"${SS_PASSWORD}",
    "timeout":600,
    "method":"aes-256-gcm",
    "fast_open":false,
    "nameserver":"8.8.8.8",
    "mode":"tcp_and_udp"
    "plugin":"obfs-server",
    "plugin_opts":"obfs=http"
}
EOF

# 启动
docker run -d -p --restart=always \
  ${SS_PORT}:${SS_PORT} -p ${SS_PORT}:${SS_PORT}/udp \
  --name shadowsocks-libev \
  -v /etc/shadowsocks-libev:/etc/shadowsocks-libev \
  appso/shadowsocks-libev

docker logs -f shadowsocks-libev

或者apt 安装

sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install shadowsocks
SS_FOLDER="/data/ss-apt"
SS_PORT=10056
SS_PASSWORD="abcde"
sudo mkdir $SS_FOLDER

cat > ${SS_FOLDER}/config.json <<EOF
{
    "server":"0.0.0.0",
    "server_port":${SS_PORT},
    "password":"${SS_PASSWORD}",
    "local_address": "127.0.0.1",
    "local_port":1080,
    "timeout":600,
    "method":"aes-256-cfb",
    "fast_open":false,
    "nameserver":"8.8.8.8",
    "mode":"tcp_and_udp"
}
EOF
ssserver -c ${SS_FOLDER}/config.json -d start

Leave a Reply

Your email address will not be published.