ubuntu_shadowsocks+polipo实现终端代理

  • 已有shadowsocks账号,安装polipo实现终端代理

ubuntu 安装 shadowsocks gui工具

1
2
3
sudo add-apt-repository ppa:hzwhuang/ss-qt5
sudo apt update
sudo apt install shadowsocks-qt5

安装polipo

1
sudo apt install polipo

配置polipo

1
sudo gedit /etc/polipo/config

配置内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13

# This file only needs to list configuration variables that deviate
# from the default values. See /usr/share/doc/polipo/examples/config.sample
# and "polipo -v" for variables you can tweak and further information.

logSyslog = true
logFile = /var/log/polipo/polipo.log
# Uncomment this if you want to use a parent SOCKS proxy:

socksParentProxy = "localhost:1080"
socksProxyType = socks5
#logFile=/var/log/polipo
logLevel=4

重启polipo

1
sudo service polipo restart

验证

1
curl ip.gs
1
2
3
4
5
6
7
8
9
10
11
Current IP / 当前 IP: 123.232.99.111
ISP / 运营商: ChinaUnicom
City / 城市: Jinan Shandong
Country / 国家: China
IP.GS is now IP.SB, please visit https://ip.sb/ for more information. / IP.GS 已更改为 IP.SB ,请访问 https://ip.sb/ 获取更详细 IP 信息!
Please join Telegram group https://t.me/sbfans if you have any issues. / 如有问题,请加入 Telegram 群 https://t.me/sbfans

/\_/\
=( °w° )=
) ( //
(__ __)//

验证代理

1
http_proxy=http://localhost:1081 curl ip.gs

1
2
3
4
5
6
7
8
9
10
11
Current IP / 当前 IP: 149.248.17.176
ISP / 运营商: choopa.com
City / 城市: Los Angeles California
Country / 国家: United States
IP.GS is now IP.SB, please visit https://ip.sb/ for more information. / IP.GS 已更改为 IP.SB ,请访问 https://ip.sb/ 获取更详细 IP 信息!
Please join Telegram group https://t.me/sbfans if you have any issues. / 如有问题,请加入 Telegram 群 https://t.me/sbfans

/\_/\
=( °w° )=
) ( //
(__ __)//

看上面结果代理已经可以使用了!

使用代理下载github上的资源需要先设置代理才可以

1
2
git config --global http.proxy=localhost:1081
git clone https://github.com/xx/xxx.git

长期使用代理方法

上面的方法配置了该终端的会话的代理,但是每次打开终端都设置一遍会很烦。这时候,可以在~/.bashrc里设置:

1
sudo gedit ~/.bashrc

文件末尾增加如下内容:

1
2
alias gp="config --global http.proxy=localhost:1081"
alias hp="http_proxy=http://localhost:1081"

保存关闭后运行下面的命令刷新配置

1
source ~/.bashrc

以后可以直接使用gp 和 hp 简写命令使用代理!xxxxxxxxxx

文章目录
  1. 1. ubuntu 安装 shadowsocks gui工具
  2. 2. 安装polipo
  3. 3. 配置polipo
  4. 4. 重启polipo
  • 验证
  • 长期使用代理方法
  • ,