1.Ubuntu

一、 apt-get 代理设置

由于公司通过代理上网,firefox的代理设置很容易就搞定了,但是通过apt-get安装软件还是不行,于是,查阅了很多资料,最多的方法就是网上流传的三种方法,试了一下还是失败,最后在详细阅读了apt-get的man之后终于成功了,与大家分享下。

每次可以通过下面的命令来安装软件。

sudo apt-get install software_name -o Acquire::http::proxy="http://your_proxy_address:端口号/"

当然,apt-get 还有个-c选项,可以用来指定使用哪个proxy配置文件,所以,也可以把所有的代理的配置写在文件中,然后执行一下:

sudo apt-get -c ~/apt_proxy.conf

配置文件的格式,如下:

Acquire::http::proxy "http://your_proxy_adress1:端口号/";

Acquire::ftp::proxy "ftp://your_proxy_adress2:端口号/";

Acquire::https::proxy "https://your_proxy_adress3:端口号/";

配置文件对于添加多个proxy address比较方便,不过,个人建议第一种方法,毕竟用代理的时候少!

二、 wget 代理设置

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

三、gem 代理设置

sudo gem install --http-proxy http://localhost:8888 $gem_name

例如:sudo gem install --http-proxy http://192.30.1.35:8080 jekyll

四、建立文件 /etc/apt/apt.conf

Acquire::http::proxy "http://用户名:密码@代理地址:端口号/";

Acquire::https::proxy "https://用户名:密码@代理地址:端口号/";

Acquire::ftp::proxy "ftp://用户名:密码@代理地址:端口号/";

Acquire::socks::proxy "socks://用户名:密码@代理地址:端口号/";

五、为wget设置代理

建立文件~/.wgetrc,填写以下内容:

http_proxy=http://代理地址:端口号

https_proxy=https://代理地址:端口号

ftp_proxy=ftp://代理地址:端口号

proxy_user=用户名

proxy_password=密码

use_proxy=on

2.Centos

YUM代理设置

编辑/etc/yum.conf,在最后加入

# Proxy

proxy=http://username:password@proxy_ip:port/

也可以使用proxy_username和proxy_password来配置代理的用户名和密码

这样的配置完成后,所有的用户在使用yum时,都会使用代理,可以说是全局代理。

如果需要为单独的用户配置代理,可以在用户的~/.bash_profile中设置。

Wget的代理设置

编辑/etc/wgetrc,在最后加入

# Proxy

http_proxy=http://username:password@proxy_ip:port/

ftp_proxy=http://username:password@proxy_ip:port/

系统全局代理

如果需要为某个用户设置一个系统级的代理,可以在~/.bash_profile中设置:

http_proxy="http://username:password@proxy_ip:port"

export_http_proxy

上面的设置只对某个用户生效,如果要对所有系统用户生效,写在/etc/profile中就可以了。

ubuntu and centos各种上网代理设置的更多相关文章

  1. centos 终端界面代理设置

    一.centos自带界面设置代理 1. 界面设置 squid默认代理端口3128. 2. firefox设置 设置 -> 局域网设置 -> ip:port / username:passw ...

  2. 关于centos的yum代理设置

    10. 有代理服务器时使用 yum默认情况下,yum 通过 HTTP 连接到网络上的仓库.所有 yum HTTP 操作都使用 HTTP/1.1,与支持这一标准的 web 代理服务器兼容.您也可以连接到 ...

  3. 原创:Eclipse 上网代理设置(亲测有效)

    直接上图:

  4. linux系统环境代理设置

    系统上网代理设置: 1.编辑文件/etc/profile,增加如下两行 export http_proxy=http://ip:port export https_proxy=http://ip:po ...

  5. centos设置上网代理

    假设我们要设置代理为 IP:PORT 1.网页上网网页上网设置代理很简单,在firefox浏览器下 Edit-->>Preferences-->>Advanced-->& ...

  6. CentOS TinyProxy http(s)上网代理及置代理上网的方法

    http://blog.csdn.net/fwj380891124/article/details/42168683 http://computer.uoh.edu.cn/linux/2159.htm ...

  7. ubuntu 代理设置

    在学习工作中使用vagrant作为开发环境已经有很长一段时间了,使用ubuntu 作为开发系统 在使用中发现,即使修改了apt的source.list源文件,在面对一些开发中需要的软件工具的时候,不可 ...

  8. CentOS代理设置

    1.全局的代理设置: vi /etc/profile 添加下面内容 http_proxy = http://username:password@yourproxy:8080/ftp_proxy = h ...

  9. Ubuntu 的 apt-get 代理设置(zhuan)

    url: http://qixinglu.com/post/ubuntu_apt-get_proxy_setup.html 升级到 Ubuntu10.04 后,发现 apt-get 的代理设置有改变了 ...

随机推荐

  1. 1.纯 CSS 创作一个按钮文字滑动特效 + 弹幕(残缺)

    原文地址:1# 视频演示如何用纯 CSS 创作一个按钮文字滑动特效 扩展后地址:https://scrimba.com/c/cJkzMfd HTML代码: <html> <head& ...

  2. OpenACC数据管理语句

    ▶ 书中第4章,数据管理部分的代码和说明 ● 代码,关于 copy,copyin,copyout,create #include <stdio.h> #include <openac ...

  3. JSON解析工具比较,主要GSON和FastJSON

    JSON解析工具比较,主要GSON和FastJSON 一 .各个JSON技术的简介和优劣 1.json-lib json-lib最开始的也是应用最广泛的json解析工具,json-lib 不好的地方确 ...

  4. ADO接口简介

    源地址:http://blog.csdn.net/xiaobai1593/article/details/7449151 参考: 1. 百度文库:http://wenku.baidu.com/view ...

  5. Ubuntu下启动 Redis时, 提示 "Can't open the log file: Permission denied failed"

    问题来源:在删除var目录下的log文件时,将redis文件夹删除了.然后在重启时:/etc/init.d/redis-server start,提示: Starting redis-server: ...

  6. zookeeper 初步学习

    配置文件: tickTime:这个时间是作为 Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳. dataDir:顾名思义就是 ...

  7. Delphi 动态数组合并

    TIntArray = array of Integer; function MergeArray(const ArrayA, ArrayB: TIntArray): TIntArray; var i ...

  8. Validate the date format

    Validate the date format function checkdate(input) { var validformat = /^\d{2}\/\d{2}\/\d{4}$/; //Ba ...

  9. conductor元数据定义

    Task Definition conductor维护工作任务类型的注册表. 必须在工作流中使用之前注册任务类型. 例如: { "name": "encode_task& ...

  10. Python 字符串操作,截取,长度

    1.字符串操作: 字符串长度: s = "; slen = len(s); 字符串截取: print s[:-:-] #截取,逆序隔1个取一个字符 print s[:-:-] #截取,逆序隔 ...