centos7 安装shadowsocks客户端 - CSDN博客

2017年05月24日 17:21:30 3348人阅读 评论(0) 收藏 举报
.
分类:
Linux(24)
.

版权声明:转载请注明出处 http://blog.csdn.net/guyan0319 https://blog.csdn.net/guyan0319/article/details/72681796

目录(?)[+]

对于技术人员在服务器上安装各种软件,经常会遇到无法访问国外网站的情况,具体原因你懂得。

解决以上问题,可以通过代理的方式,推荐使用shadowsocks。

系统环境:centos7

安装步骤:

1安装shadowsocks

Pip 是 Python 的包管理工具,这里我们用 pip 安装 shadowsocks。

首先安装epel扩展源:

yum -y install epel-release

pip install shadowsocks # pip安装ss客户端


2、编辑配置文件


新建配置文件

vi /etc/shadowsocks.json

填写以下内容

{

"server":"SERVER-IP", # 你的服务器ip

"server_port":PORT, # 服务器端口

"local_address": "127.0.0.1", # 本地ip

"local_port":1080, # 本地端口

"password":"PASSWORD", # 连接 ss 密码

"timeout":300, # 等待超时

"method":"chacha20", # 加密方式

"fast_open": false, # tcp_fastopen

"workers": 1 #工作线程数

}

3、启动 shadowsocks

$ nohup sslocal -c /etc/shadowsocks.json &1 &

虽然socks代理起来了,但是还不能直接用,需要privoxy转发一下

4、使用 Privoxy 转发

Shadowsocks 是一个 socket5 服务,我们需要使用 Privoxy 把流量转到 http/https 上。

yum -y install privoxy

配置

echo 'forward-socks5 / 127.0.0.1:1080 .' >> /etc/privoxy/config


5、启动 privoxy


systemctl start privoxy

6、设置http/https代理

配置 /etc/profile

vi /etc/profile

添加下面两句:

export http_proxy=http://127.0.0.1:8118    #这里的端口和上面 privoxy 中的保持一致

export https_proxy=http://127.0.0.1:8118

运行以下:

source /etc/profile

7、 测试生效:

curl www.google.com

## 如果出现下面这段输出则代理成功!

302 Moved

302 Moved

The document has moved

here.

curl ip.cn # 查看ip是否是你的ss服务器地址


至此shadowsocks客户端安装完成。




comments powered by Disqus