centos7.2 64位安装shadowsocks服务端
$ curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
$ python get-pip.py
$ pip install --upgrade pip
$ pip install shadowsocks
$ vi /etc/shadowsocks.json
{
"server":"0.0.0.0",
"server_port":8586,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"cntsp",
"timeout":600,
"method":"aes-256-cfb",
"fast_open": true,
"workers": 1
}
# method为加密方法,可选aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, cast5-cfb, des-cfb, rc4-md5, chacha20, salsa20, rc4, table
# server_port为服务监听端口
# password为密码,可使用密码生成工具生成一个随机密码
$ vi /etc/systemd/system/shadowsocks.service
[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json
[Install]
WantedBy=multi-user.target
执行以下命令启动 shadowsocks 服务:
$ systemctl enable shadowsocks
$ systemctl start shadowsocks
如果服务启动成功,则控制台显示的信息可能类似这样:
为了检查 shadowsocks 服务是否已成功启动,可以执行以下命令查看服务的状态:
systemctl status shadowsocks -l
● shadowsocks.service - Shadowsocks
Loaded: loaded (/etc/systemd/system/shadowsocks.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2017-09-29 14:27:30 CST; 44s ago
Main PID: 18957 (ssserver)
CGroup: /system.slice/shadowsocks.service
└─18957 /usr/bin/python /usr/bin/ssserver -c /etc/shadowsocks.json
Sep 29 14:27:30 iZj6c9klzk45d0qfxy88znZ systemd[1]: Started Shadowsocks.
Sep 29 14:27:30 iZj6c9klzk45d0qfxy88znZ systemd[1]: Starting Shadowsocks...
Sep 29 14:27:30 iZj6c9klzk45d0qfxy88znZ ssserver[18957]: INFO: loading config from /etc/shadowsocks.json
Sep 29 14:27:30 iZj6c9klzk45d0qfxy88znZ ssserver[18957]: 2017-09-29 14:27:30 INFO loading libcrypto from libcrypto.so.10
Sep 29 14:27:30 iZj6c9klzk45d0qfxy88znZ ssserver[18957]: 2017-09-29 14:27:30 INFO starting server at 0.0.0.0:8586
centos7.2 64位安装shadowsocks客户端
$ curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
$ python get-pip.py
$ pip install --upgrade pip
$ pip install shadowsocks
$ vi /etc/shadowsocks.json
{
"server":"x.x.x.x", #你的 ss 服务器 ip
"server_port":8586, #你的 ss 服务器端口
"local_address": "127.0.0.1", #本地ip
"local_port":1080, #本地端口
"password":"cntsp", #连接 ss 密码
"timeout":300, #等待超时
"method":"aes-256-cfb", #加密方式
"workers": 1 #工作线程数
}
启动:
sslocal -c /etc/shadowsocks.json -d start
测试是否连上ss的服务端
运行 curl –socks5 127.0.0.1:1080 http://httpbin.org/ip,如果返回你的 ss 服务器 ip 则测试成功:
{
"origin": "x.x.x.x" #你的 ss 服务器 ip
}