zoukankan      html  css  js  c++  java
  • Ubuntu12.04 使用apt-get如何设置代理

    1、建立一个apt-get使用代理的配置文件,文件名称随意,我这里命名为apt-get-proxy.conf,放到~目录下即可
    2、用vim或者gedit等文本编辑器打开文件,输入如下内容:
    Acquire::http::proxy  "http://用户名:密码@代理服务器IP:代理服务器端口"; 
    Acquire::https::proxy  "https://用户名:密码@代理服务器IP:代理服务器端口"; 
    Acquire::ftp::proxy  "ftp://用户名:密码@代理服务器IP:代理服务器端口"; 
    其中用户名、密码、代理服务器IP、代理服务器端口根据实际情况修改即可
    如果不需要用户名和密码,可以写成如下的:
    Acquire::http::proxy  "http://代理服务器IP:代理服务器端口"; 
    Acquire::https::proxy  "https://代理服务器IP:代理服务器端口"; 
    Acquire::ftp::proxy  "ftp://代理服务器IP:代理服务器端口"; 
    然后保存
     
    3、打开终端,输入:

    sudo apt-get install software-name -c ~/apt-get-proxy.conf 

    就可以了。
    software-name  表示软件软件的名字
    -c 表示使用指定的配置文件
    ~/apt-get-proxy.conf  表示刚才创建的配置文件
     
    4 、还有更简单的一种方式:
    sudo apt-get   install software-name -o Acquire::http::proxy="http://用户名:密码@代理服务器IP:代理服务器端口"
    如果不需要用户名和密码使用如下方式:
     sudo apt-get  install software-name -o Acquire::http::proxy="http://代理服务器IP:代理服务器端口"
          -o 表示代理设置,可以不用配置文件方式
     
     
  • 相关阅读:
    TCP/IP协议栈与数据包封装+TCP与UDP区别
    MySQL数据库优化总结
    MySQL存储引擎,锁,优化简述
    java实现常见查找算法
    Java的几种常见排序算法
    UML类图学习
    高性能的RTC服务器OpenFire
    常用的设计模式
    Swing JInternalFrame的使用
    Qt 模态与非模态
  • 原文地址:https://www.cnblogs.com/cane/p/3850504.html
Copyright © 2011-2022 走看看