个人工具
登录
查看“UbuntuHelp:AptProxy/zh”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:AptProxy/zh”的源代码
来自Ubuntu中文
←
UbuntuHelp:AptProxy/zh
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{Translation}}<br>{{From|http://wiki.ubuntu.org.cn/UbuntuHelp:AptProxy}}<br>{{Translator|李威}}<br>{{Languages|zh-hans}} === 简述 === apt-proxy is a program that caches the packages you download from the Internet, to your hard disk. Because apt-proxy behaves as if it were a HTTP server with a full copy of the repositories you select, you can access the packages from other computers on your network. If a package is not in the cache, apt-proxy automatically downloads and caches it. This can significantly decrease download bandwidth and installation time when you have to install the same packages repeatedly (i.e. an upgrade of multiple machines). === 安装 === apt-proxy 已经包含在通用档案文件中。要安装,在终端中运行命令: <pre>sudo apt-get install apt-proxy</pre> === === 配置 === === 默认设置 === The first section of the apt-proxy configuration file, located at /etc/apt-proxy/apt-proxy-v2.conf, contains the default settings for the apt-proxy and its cache. The first step is to check the address parameter to the IP of your apt-proxy server in the internal network. If it is commented out, apt-proxy will listen on all the IP addresses of your server. The port parameter specifies the port apt-proxy listens on for requests and defaults to 9999, which is generally a good value to use. If you wish to change the directory that apt-proxy stores its cached packages, change the cache_dir parameter. The cache directory defaults to /var/cache/apt-proxy. If you are using a web proxy server (such as Squid), you can configure apt-proxy to be aware of it with http_proxy = proxy_server:port. If you are behind a firewall you may experience problems with active FTP connections when trying to connect to a FTP backend. passive_ftp = on should solve this problem. The other values control the time a package remains in the cache, how old a package must be at least before apt-proxy checks for newer versions or how often the cache is checked for old packages. They can safely be left on their default values. ==== Backends ==== apt-proxy has to know where to find remote repositories, which it refers to as backends. This is done via backend sections in /etc/apt-proxy/apt-proxy-v2.conf. A backend entry for Ubuntu may look like this: <pre>[ubuntu] ;; Ubuntu archive backends = http://archive.ubuntu.com/ubuntu http://de.archive.ubuntu.com/ubuntu</pre> 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: <pre>[ubuntu-slow] timeout = 60 ;wait 1 Minute backends = prot://some.very.slow.server.net/ubuntu-slow</pre> A complete example '''apt-proxy-v2.conf'''may look like this: <pre>[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</pre> 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. <br><br>
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
模板:Translator
(
查看源代码
)
返回至
UbuntuHelp:AptProxy/zh
。