Set up shadowsocks+polipo global agent in linux environment

  • 2020-11-20 06:22:50
  • OfStack

1. Install shadowsocks
sudo apt-get install python-pip
sudo pip install shadowsocks


2. Create configuration file shadowsocks.json, where the server address, port number, and password are the servers purchased or used for free (such as www.ishadowsocks.org)


{
 "server": "xxxx.com",
 "server_port": 52239,
 "local_address": "127.0.0.1",
 "local_port": 1080,
 "password": "SOME_PASSWORD",
 "timeout": 600,
 "method": "aes-256-cfb",
 "fast_open": false
}

3. Start shadowsocks
sslocal -c shadowsocks.json

4. Install polipo and forward it twice (shadowsocks USES socks5 protocol to communicate, which needs to be used with browser plug-in; if you want to use it globally, you can use polipo to forward it twice)
sudo apt-get install polipo

5. Edit the configuration file and save it to /etc/polipo/config


# 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
 
proxyAddress = "0.0.0.0"
 
socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5
 
chunkHighMark = 50331648
objectHighMark = 16384
 
serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32

6. Restart polipo service
sudo service polipo restart

7. Set environment variable (can be added to ~/.bashrc file to make all shell accessible to global SOCKS5)
export http_proxy="http://127.0.0.1:8123"
export https_proxy="https://127.0.0.1:8123"

8. Check whether the main page of google can be obtained through socks5 protocol under 1
curl www.google.com
If successful, it is accessible.


Related articles: