CentOS 7安装配置Shadowsocks客户端
安装配置Shadowsocks客户端
- 安装epel扩展源
yum -y install epel-release
- 采用Python包管理工pip安装
yum -y install python-pip
- 安装epel扩展源
配置Shadowsocks客户端
vim /etc/shadowsocks/shadowsocks.json
{ "server":"1.1.1.1", Shadowsocks服务器地址 "server_port":6666, Shadowsocks服务器端口 "local_address": "127.0.0.1", 本地IP "local_port":1080, 本地端口 "password":"password", Shadowsocks连接密码 "timeout":300, 等待超时时间 "method":"aes-256-cfb", 加密方式 "fast_open": false, true或false。开启fast_open以降低延迟,但要求Linux内核在3.7+。开启方法 echo 3 > "workers": 1 工作线程数 } <!--hexoPostRenderEscape:<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">- 配置自启动</span><br><span class="line"></span><br><span class="line"> - 新建启动脚本文件/etc/systemd/system/shadowsocks.service</span><br><span class="line"></span><br><span class="line"> - ```[Unit]</span><br><span class="line"> [Unit]</span><br><span class="line"> Description=Shadowsocks</span><br><span class="line"></span><br><span class="line"> [Service]</span><br><span class="line"> TimeoutStartSec=0</span><br><span class="line"> ExecStart=/usr/bin/sslocal -c /etc/shadowsocks/shadowsocks.json</span><br><span class="line"></span><br><span class="line"> [Install]</span><br><span class="line"> WantedBy=multi-user.target</span><br></pre></td></tr></table></figure>:hexoPostRenderEscape-->
启动Shadowsocks客户端
systemctl enable shadowsocks.service
systemctl start shadowsocks.service
systemctl status shadowsocks.service
验证Shadowsocks客户端是否正常运行
curl --socks5 127.0.0.1:1080 http://httpbin.org/ip
若Shadowsock客户端已正常运行,则结果如下:
{ "origin": "x.x.x.x" #你的Shadowsock服务器IP }
安装配置Privoxy
yum -y install privoxy
- 启动 Privoxy
systemctl enable privoxy
systemctl start privoxy
systemctl start privoxy
配置Privoxy
- 修改配置文件 /etc/privoxy/config
vim /etc/privoxy/config
forward-socks5t / 127.0.0.1:1080 .
#转发到本地端口- 设置 http/https 代理
vim /etc/profile
- 添加如下信息:
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
- source /etc/profile
验证是否可用:
curl www.google.com