1. 程式人生 > 實用技巧 >ubuntu 16.04 & 20.04 安裝ss與終端穿越

ubuntu 16.04 & 20.04 安裝ss與終端穿越

下面所有xxxxx自行替換為ss(防部落格敏感詞過濾)

ubuntu 16.04 安裝ss與終端穿越

安裝

sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:max-c-lv/xxxxx-libev -y
sudo apt-get update
sudo apt install xxxxx-libev

使用範例,自行替換

ss-local -s 144.134.129.5 -p 7580 -k "xxxxxxxp" -l 1080 -t 600 -m aes-256-gcm

sudo vim /etc/xxxxx-libev/config.json

{
 "server":"$your_server",
 "server_port":$your_server_port,
 "local_address":"$your-server",
 "local_port":10800,
 "password":"$your_password",
 "timeout":600,
 "method":"aes-256-cfb"
}

sudo ss-local -c /etc/xxxxx-libev/config.json

開機自啟動

sudo vim /etc/rc.local

### exit 0 前新增
nohup ss-local >/dev/null 2>&1 &

終端穿越

privoxy

### install
sudo apt-get install privoxy

### update config
sudo vim /etc/privoxy/config

### 在4.1末尾新增
listen-address  localhost:8118
listen-address  [::1]:8118

### 在5.2末尾新增
forward-socks5 / 127.0.0.1:1080 .

### 重啟服務
sudo /etc/init.d/privoxy restart

### 配置一下終端的環境
export http_proxy="127.0.0.1:8118"
export https_proxy="127.0.0.1:8118"

### 開機自啟動
sudo vim /etc/rc.local
### exit 0 前新增
sudo /etc/init.d/privoxy start

### 在/etc/profile的末尾新增如下兩句
export http_proxy="127.0.0.1:8118"
export https_proxy="127.0.0.1:8118"

polipo

  • Install polipo
sudo apt-get install polipo
  • Edit config file
sudo vim /etc/polipo/config
  • add
logSyslog = true
logFile = /var/log/polipo/polipo.log
proxyAddress = "0.0.0.0"
socksParentProxy = "127.0.0.1:10800"
socksProxyType = socks5
chunkHighMark = 50331648
objectHighMark = 16384
serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32
  • Restart polipo service
sudo service polipo stop
sudo polipo socksParentProxy=localhost:10800
sudo service polipo start
  • ENV(Add to ~/.bashrc)
export http_proxy=http://127.0.0.1:8123
export https_proxy=https://127.0.0.1:8123
git config --global http.proxy socks5://localhost:10800
git config --global https.proxy socks5://localhost:10800

git config --global http.https://github.com.proxy socks5://127.0.0.1:10800
git config --global https.https://github.com.proxy socks5://127.0.0.1:10800
git config --global --unset http.proxy
git config --global --unset https.proxy
  • Test if socks5 can connect google
curl www.google.com

ubuntu 20.04 安裝ss

終端穿越與16.04一樣,安裝過程如下

sudo apt install xxxxx-libev

### 停止預設的 ss-server 服務並禁用開機自啟:
sudo systemctl stop --now xxxxx-libev.service

### 從網路服務提供者獲取配置,寫入 /etc/xxxxx-libev/client.json,執行 ss-local 服務並啟用開機自啟
sudo systemctl start --now [email protected]

### 或者
ss-local -s 144.134.129.5 -p 7580 -k "xxxxxxxp" -l 1080 -t 600 -m aes-256-gcm