1. 程式人生 > >Ubuntu 通過 socks5代理更快速的安裝更新

Ubuntu 通過 socks5代理更快速的安裝更新

  • vi /etc/tsocks.conf
  • 做一個簡單的配置就好了:
  • local = 192.168.1.0/255.255.255.0  #local表示本地的網路,也就是不使用socks代理的網路
  • local = 127.0.0.0/255.0.0.0
  • server = 127.0.0.1   #socks伺服器的IP
  • server_type = 5  #socks服務版本
  • server_port = 7070  #socks服務使用的埠
  • 要注意的是"server"中的IP必須包含在"local"裡面,否則不能使用,比如使用apt更新的時候會報下面這個錯誤:
  • 0% [Working]20:13:21 libtsocks(11619): SOCKS server xxx.xx.xxx.xxx (xxx.xxx.xxx.xxx) is not on a local subnet!
  • 使用tsocks代理apt-get:
  • tsocks apt-get update
  • tsocks aptitude upgrade
  • ...
  • 很簡單,就是在命令前面加上"tsocks"就可以了,tsocks會使用"exec"來執行命令。