---
title: "在Ubuntu用代理使用apt-get命令"
author: "evil850209"
date: "2013-08-05T14:48:30Z"
tags: ["Linux", "Ubuntu"]
categories: ["操作系统"]
slug: "ubuntu-apt-get"
draft: false
lastmod: "2013-08-05T14:49:22Z"
id: 1920219
url: "https://evil850209.iteye.com/blog/1920219"
---

现在许多公司都有自己的代理服务器来控制员工上网。对用我们使用Linux系统，如Ubuntu，更新软件就会有一定的障碍。

在Ubuntu下，如果你想通过代理来访问apt-get上的源，可以修改或者添加一个/etc/apt/apt.conf文件


```sh
sudo vi /etc/apt/apt.conf
```


然后在文件中添加内容如下：


```conf
Acquire::http::proxy "http://127.0.0.1:8000/";
Acquire::ftp::proxy "ftp://127.0.0.1:8000/";
Acquire::https::proxy "https://127.0.0.1:8000/";
```


这样就可以使用代理服务器访问apt-get上的源了。

要想编辑源的列表，可以修改 


```sh
vi /etc/apt/sources.list
```



```config
deb http://cn.archive.ubuntu.com/ubuntu/ raring main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ raring main restricted
```