此文是配置代理客戶端,解決fanqiang的問題
1、安裝shadowsocks
~ pip install shadowsocks
若無pip
~ curl -O https://bootstrap.pypa.io/get-pip.py
~ python get-pip.py
2、安裝privoxy
# 安裝epel源
# 下載
~ wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# 安裝epel
~ rpm -ivh epel-release-latest-7.noarch.rpm
# 安裝privoxy
~ yum install privoxy -y
3、配置shadowsocks
添加客戶端配置文件
~ vim /etc/shadowocks.json
編輯內容如下
{
"server": "<ip>",
"server_port": <port>,
"password": "<password>",
"method": "aes-256-cfb",
"local_address": "127.0.0.1",
"local_port": 1080
}
配置服務
~ vim /etc/systemd/system/shadowsocks.service
編輯內容如下
[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks.json
[Install]
WantedBy=multi-user.target
4、配置privoxy
~ vim /etc/privoxy/config
如下配置
listen-address 127.0.0.1:8118
forward-socks5t / 127.0.0.1:1080 .
5、啓動服務
~ systemctl start privoxy shadowsocks
6、設置本地http代理
vim /etc/profile
添加內容如下
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
執行如下命令
# 加載配置
~ source /etc/profile
7、測試
# 應該可以順利打開
~ curl www.google.com
8、關閉代理
# 停止服務
~ systemctl stop shadowsocks privoxy
# 註釋 http_proxy https_proxy
~ vim /etc/profile
# 重新加載配置文件
~ source /etc/profile
# 移除http_proxy、https_proxy
~ unset http_proxy https_proxy
# 測試
~ curl www.google.com # 應該無法訪問了
參考鏈接:https://docs.lvrui.io/2016/12/12/Linux中使用ShadowSocks-Privoxy代理/