taro-mall
taro-mall copied to clipboard
shadowsocks命令行pac配置docker翻墙篇
#安装相关软件(只升级所有包,不升级软件和系统内核)
yum upgrade -y
yum install python-pip
pip install shadowsocks
yum install privoxy -y
pip install --user gfwlist2privoxy
#修改shadowsocks配置文件
cat>/etc/shadowsocks.conf<<EOF
{
"server":"你的国外服务器IP",
"server_port":端口,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"密码",
"timeout":300,
"method":"加密method",
"fast_open": false,
"workers": 1
}
EOF
#配置docker环境变量
mkdir /etc/systemd/system/docker.service.d
cat>/etc/systemd/system/docker.service.d/http-proxy.conf<<EOF
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:8118/"
Environment="HTTPS_PROXY=http://127.0.0.1:8118/"
Environment="NO_PROXY=127.0.0.1,localhost,0.0.0.0"
EOF
#配置环境变量
cat>>~/.bash_profile<<EOF
proxy="http://127.0.0.1:8118"
export https_proxy=$proxy
export http_proxy=$proxy
EOF
#修改gfwlist
cd /tmp
wget https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt
~/.local/bin/gfwlist2privoxy -i gfwlist.txt -f gfwlist.action -p 127.0.0.1:1080 -t socks5
cp gfwlist.action /etc/privoxy/
cat>>/etc/privoxy/config<<EOF
actionsfile gfwlist.action
EOF
#启动服务
sslocal -c /etc/shadowsocks.conf -d start
service privoxy start
cd ~
source .bash_profile
systemctl daemon-reload
systemctl restart docker