1. 程式人生 > >Ubuntu設定代理和例外

Ubuntu設定代理和例外

le/details/48377593

sudo gedit  /etc/environment

加入如下幾行

代理

#config for http proxy export http_proxy=http://XXX.XXX.XXX.XXX:XXXX export https_proxy=http://XXX.XXX.XXX.XXX:XXXX export ftp_proxy=http://XXX.XXX.XXX.XXX:XXXX

例外:

# for common

no_proxy="127.0.0.1, localhost, 172.26.*, 172.25.6.66, *.google.*, *.facebook.com, 192.168.*, developer.android.com"

每個例外用【,】間隔

# for chrome firefox

gsettings set org.gnome.system.proxy ignore-hosts "['127.0.0.1', 'localhost', '172.26.*' ]"

# for apt-get

sudo gedit /etc/apt/apt.conf

Acquire::http:proxy "http://proxy_address:proxy_port"

Acquire::https:proxy "https://proxy_address:proxy_port"

Acquire::ftp:proxy "ftp://proxy_address:proxy_port"

Acquire::socks:proxy "socks://proxy_address:proxy_port"

環境變數即時生效

source /etc/environment

檢視環境變數設定

export