---
title: "ubuntu 12.04的代理设置"
author: "dss16694"
date: "2013-04-09T15:48:38Z"
tags: []
categories: ["移动开发"]
slug: "ubuntu-12-04"
draft: false
lastmod: "2013-04-09T15:48:38Z"
id: 1844537
url: "https://dss16694.iteye.com/blog/1844537"
---

## ubuntu 12.04的代理设置

      安装了ubuntu的最新LTS版本 12.04, 需要重新下载android的源码，由于公司使用了代理服务器，在网络配置方面方面遭遇了各种问题，系统动不动就弹出407 Proxy Authentication Required,不厌其烦～

 1.apt-get 设置代理

在目录/etc/apt中找到apt.conf文件,按照如下方式设置即可,例如用户名为sgj, 密码为shiguojun

Acquire::http::proxy "http://sgj:shiguojun@10.0.2.254:8080/";

 

2.repo 设置代理。

 

查了好半天，还是在google的说明里面找到了方法。

 

Troubleshooting network issues

When downloading from behind a proxy (which is common in some corporate environments), it might be necessary to explicitly specify the proxy that is then used by repo:

```
$ export HTTP_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
$ export HTTPS_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
```

HTTP\_PROXY是设置http代理，HTTPS\_PROXY是设置https代理。