“UbuntuHelp:AptProxy/zh”的版本间的差异
来自Ubuntu中文
小 |
小 |
||
第15行: | 第15行: | ||
在apt-proxy配置文件 ''/etc/apt-proxy/apt-proxy-v2.conf'' 的第一节中,包含了apt-proxy及其缓存的默认设置。第一步就是设置 address 参数,将其设置为内网中作为apt-proxy服务器的IP。 如果该项被注释掉,apt-proxy会监听服务器的所有的IP地址。port 参数指定了apt-proxy要监听的请求端口,其默认设置为9999,通常情况下用这个值就很合适了。 如果你想改变apt-proxy缓存软件包的目录,更改 cache_dir 参数即可。缓存目录默认设为 ''/var/cache/apt-proxy''。如果你使用了网页代理服务器(如,Squid),你可以配置apt-proxy使用代理,设置方法为 http_proxy = proxy_server:port 。如果你在防火墙之后,那么你用主动FTP连接去连接到一个FTP后端时可能会出问题。而 passive_ftp = on 应该能解决这个问题。另外的一个值控制软件包在缓存中保存多长时间。也就是说,在apt-proxy检查更新版本前软件包应至少存在了多长时间,或者说缓存中的软件包每隔多长时间查找一次更新版本。在到达这个默认值时,它们就被安全地抛弃了。 | 在apt-proxy配置文件 ''/etc/apt-proxy/apt-proxy-v2.conf'' 的第一节中,包含了apt-proxy及其缓存的默认设置。第一步就是设置 address 参数,将其设置为内网中作为apt-proxy服务器的IP。 如果该项被注释掉,apt-proxy会监听服务器的所有的IP地址。port 参数指定了apt-proxy要监听的请求端口,其默认设置为9999,通常情况下用这个值就很合适了。 如果你想改变apt-proxy缓存软件包的目录,更改 cache_dir 参数即可。缓存目录默认设为 ''/var/cache/apt-proxy''。如果你使用了网页代理服务器(如,Squid),你可以配置apt-proxy使用代理,设置方法为 http_proxy = proxy_server:port 。如果你在防火墙之后,那么你用主动FTP连接去连接到一个FTP后端时可能会出问题。而 passive_ftp = on 应该能解决这个问题。另外的一个值控制软件包在缓存中保存多长时间。也就是说,在apt-proxy检查更新版本前软件包应至少存在了多长时间,或者说缓存中的软件包每隔多长时间查找一次更新版本。在到达这个默认值时,它们就被安全地抛弃了。 | ||
− | ==== | + | ==== 后端 ==== |
− | apt- | + | apt-proxy知道从哪个远程软件仓库中查找软件包,这是由于其引入了一个后端设置。通过 ''/etc/apt-<br>proxy/apt-proxy-v2.conf'' 中的 backend 节来完成后端设置。一个后端 Ubuntu条目看起来类似于这样: |
<pre>[ubuntu] | <pre>[ubuntu] | ||
;; Ubuntu archive | ;; Ubuntu archive |
2008年3月25日 (二) 08:56的版本
点击翻译: |
English • 中文 |
简述
apt-proxy程序将你从网络上下载下来的软件包缓存到本地磁盘。apt-proxy的行为就像一台包含那些你所选择软件包全部拷贝的HTTP服务器。你可以从本地网络上的其他计算机上存取这些软件包。如果软件包还没有被缓存,apt-poxy会自动下载并缓存上。这对那些需要重复安装同样软件包的人来说(如,为多台机子升级),非常有效的节约了下载带宽和安装的时间。
安装
apt-proxy 已经包含在通用档案文件中。要安装,在终端中运行命令:
sudo apt-get install apt-proxy
配置apt-proxy服务器
默认设置
在apt-proxy配置文件 /etc/apt-proxy/apt-proxy-v2.conf 的第一节中,包含了apt-proxy及其缓存的默认设置。第一步就是设置 address 参数,将其设置为内网中作为apt-proxy服务器的IP。 如果该项被注释掉,apt-proxy会监听服务器的所有的IP地址。port 参数指定了apt-proxy要监听的请求端口,其默认设置为9999,通常情况下用这个值就很合适了。 如果你想改变apt-proxy缓存软件包的目录,更改 cache_dir 参数即可。缓存目录默认设为 /var/cache/apt-proxy。如果你使用了网页代理服务器(如,Squid),你可以配置apt-proxy使用代理,设置方法为 http_proxy = proxy_server:port 。如果你在防火墙之后,那么你用主动FTP连接去连接到一个FTP后端时可能会出问题。而 passive_ftp = on 应该能解决这个问题。另外的一个值控制软件包在缓存中保存多长时间。也就是说,在apt-proxy检查更新版本前软件包应至少存在了多长时间,或者说缓存中的软件包每隔多长时间查找一次更新版本。在到达这个默认值时,它们就被安全地抛弃了。
后端
apt-proxy知道从哪个远程软件仓库中查找软件包,这是由于其引入了一个后端设置。通过 /etc/apt-
proxy/apt-proxy-v2.conf 中的 backend 节来完成后端设置。一个后端 Ubuntu条目看起来类似于这样:
[ubuntu] ;; Ubuntu archive backends = http://archive.ubuntu.com/ubuntu http://de.archive.ubuntu.com/ubuntu
As you can see, it is possible to specify more than one server, separated by blank space. If the first server is down, apt-proxy tries to get the data from the second server and so on. Note: If the first server is up, but does not have a required file, apt-proxy will not fall back to a second server. You can also override values set in the [default-section. For instance, if you know that a special server takes very long to answer a request, you can increase the timeout value:
[ubuntu-slow] timeout = 60 ;wait 1 Minute backends = prot://some.very.slow.server.net/ubuntu-slow
A complete example apt-proxy-v2.confmay look like this:
[DEFAULT] ;; All times are in seconds, but you can add a suffix ;; for minutes(m), hours(h) or days(d) address = 127.0.0.1 port = 9999 cache_dir = /var/cache/apt-proxy ;; Control files (Packages/Sources/Contents) refresh rate min_refresh_delay = 1s complete_clientless_downloads = 1 ;; Debugging settings. debug = all:4 db:0 timeout = 30 passive_ftp = on ;;-------------------------------------------------------------- ;; Cache housekeeping cleanup_freq = 1d max_age = 120d max_versions = 3 ;;--------------------------------------------------------------- ;; Backend servers ;; ;; Place each server in its own [section] [ubuntu] ; Ubuntu archive backends = http://archive.ubuntu.com/ubuntu http://de.archive.ubuntu.com/ubuntu [ubuntu-security] ; Ubuntu security updates backends = http://security.ubuntu.com/ubuntu [marillat] backends = http://mirrors.ecology.uni-kiel.de/debian/debian-multimedia [debian] ; Backend servers, in order of preference backends = http://ftp.us.debian.org/debian http://ftp.de.debian.org/debian http://ftp2.de.debian.org/debian ftp://ftp.uk.debian.org/debian [debian-non-US] ; Debian debian-non-US archive backends = http://ftp.uk.debian.org/debian-non-US http://ftp.de.debian.org/debian-non-US ftp://ftp.uk.debian.org/debian [security] ; Debian security archive backends = http://security.debian.org/debian-security http://ftp2.de.debian.org/debian-security [openoffice] ; OpenOffice.org packages backends = http://ftp.freenet.de/pub/debian-openoffice http://ftp.sh.cvut.cz/MIRRORS/OpenOffice.deb http://borft.student.utwente.nl/debian [apt-proxy] ; Apt-proxy new versions backends = http://apt-proxy.sourceforge.net/apt-proxy
Note that you don't specify versions of distributions in this file; by enabling Ubuntu, you gain the ability to proxy for all versions (Hoary, Breezy, Dapper etc). What is downloaded depends on what is configured in the sources.list file on each client.