ubuntu 12.04 apt-get/wget/gem 使用代理安裝軟體

來源:互聯網
上載者:User

一、 apt-get 代理設定     
    由於公司通過代理上網,firefox的代理設定很容易就搞定了,但是通過apt-get安裝軟體還是不行,於是,查閱了很多資料,最多的方法就是網上流傳的三種方法,試了一下還是失敗,最後在詳細閱讀了apt-get的man之後終於成功了,與大家分享下。
     每次可以通過下面的命令來安裝軟體。

  1. sudo apt-get install software_name  -o Acquire::http::proxy="http://your_proxy_address:連接埠號碼/" 

    當然,apt-get 還有個-c選項,可以用來指定使用哪個proxy設定檔,所以,也可以把所有的代理的配置寫在檔案中,然後執行一下:
     

  1. sudo apt-get -c ~/apt_proxy.conf

設定檔的格式,如下:

  1. Acquire::http::proxy "http://your_proxy_adress1:連接埠號碼/"; 
  2. Acquire::ftp::proxy "ftp://your_proxy_adress2:連接埠號碼/"; 
  3. Acquire::https::proxy "https://your_proxy_adress3:連接埠號碼/";

設定檔對於添加多個proxy address比較方便,不過,個人建議第一種方法,畢竟用代理的時候少!

二、 wget 代理設定

  1. wget -e http-proxy=proxy.satwe.com:8080
    –proxy=on –proxy-user=hamo –proxy-passwd=8888 -c
    http://www.satwe.com

三、gem 代理設定

  1. sudo gem install --http-proxy http://localhost:8888
    $gem_name
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.