export http_proxy=https://yourproxyaddress:proxyport
僅當前終端機視窗有效,關閉即失效。
sudo nano /etc/apt/apt.conf
加入:
Acquire::http::Proxy "https://yourproxyaddress:proxyport";
儲存後 apt-get 自動使用指定代理。注意:系統安裝時可能未建立此檔,操作會自動新建。
nano ~/.bashrc
末尾加入:
http_proxy=https://yourproxyaddress:proxyport
export http_proxy
儲存後關閉終端機重新開啟生效,適用 apt-get、wget 等所有工具。
apt-get update
若修正錯誤再修改配置,必須關閉重開終端機否則新設定不生效。