網上找了有一會linux直接使用shadowsocks的方法,最后發現shadowsocks是socks5,而yum,wget,curl都是http,於是乎找了個socks5轉http的方法。
1.安裝shadowsocks 客戶端
easy_install shadowsocks
vim /etc/shadowsocks/client.conf #把下面內容寫進去,這個和shadowsocks的服務端對應。
{
"server":"x.x.x.x",
"server_port":1443,
"local_address":"127.0.0.1",
"local_port":1080,
"password":"xxxxxx",
"timeout":600,
"method":"aes-256-cfb"
}
nohup /usr/bin/python /usr/bin/sslocal -c /etc/shadowsocks/config.json >> /var/log/sslocal.log 2>&1 & #啟動shadowsocks client
2.安裝privoxy
yum install privoxy
vim /etc/privoxy/conf #添加下面內容
forward-socks5 / 127.0.0.1:1080 .
systemctl start privoxy.service #啟動privoxy
3.設置代理
vim ~/.bashrc #添加下面內容
export http_proxy=http://127.0.0.1:8118/
export https_proxy=http://127.0.0.1:8118/
export ftp_proxy=http://127.0.0.1:8118/
source ~/.bashrc #生效
vim /etc/yum.conf #添加下面內容
proxy=http://127.0.0.1:8118/
yum search gcc
能跑起來就是表示,代理成功了。