firstcommit
parent
63917c2807
commit
09065b6989
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
# privoxy aptproxy dockerproxy setup , run as root
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local:~/bin
|
||||
export PATH
|
||||
|
||||
|
||||
apt install -y privoxy
|
||||
|
||||
|
||||
# 备份
|
||||
cp /etc/privoxy/config /etc/privoxy/config.bak
|
||||
|
||||
# 在文件中插入一行forward-socks5t / 127.0.0.1:1088
|
||||
sed -i '/listen-address 127.0.0.1:8118/a forward-socks5t / 127.0.0.1:1088 .' /etc/privoxy/config
|
||||
# 修改listen-address行后的8118为1080
|
||||
sed -i 's/\(listen-address 127.0.0.1:\)8118/\11080/' /etc/privoxy/config
|
||||
|
||||
systemctl restart privoxy.service
|
||||
|
||||
|
||||
# 添加 alias 到 ~/.bashrc
|
||||
echo 'alias ftz="export http_proxy=\"127.0.0.1:1080\" && export https_proxy=\"127.0.0.1:1080\" && export no_proxy=127.0.0.1,localhost,192.168.*"' >> ~/.bashrc
|
||||
echo 'alias ctz="unset https_proxy && unset http_proxy"' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
|
||||
|
||||
# aptproxy
|
||||
echo -e "Acquire::http::Proxy \"http://127.0.0.1:1080\";" | sudo tee -a /etc/apt/apt.conf.d/proxy.conf > /dev/null
|
||||
echo -e "Acquire::https::Proxy \"http://127.0.0.1:1080\";" | sudo tee -a /etc/apt/apt.conf.d/proxy.conf > /dev/null
|
||||
|
||||
|
||||
# dockerproxy
|
||||
mkdir -p /etc/systemd/system/docker.service.d
|
||||
echo '[Service]' >> /etc/systemd/system/docker.service.d/proxy.conf
|
||||
echo 'Environment="HTTP_PROXY=http://127.0.0.1:1080/"' >> /etc/systemd/system/docker.service.d/proxy.conf
|
||||
echo 'Environment="HTTPS_PROXY=http://127.0.0.1:1080/"' >> /etc/systemd/system/docker.service.d/proxy.conf
|
||||
echo 'Environment="NO_PROXY=localhost,192.168.*"' >> /etc/systemd/system/docker.service.d/proxy.conf
|
||||
|
||||
sudo systemctl daemon-reload
|
Loading…
Reference in New Issue