特殊:Badtitle/NS100:AptProxy/zh
文章出处: |
{{#if: | {{{2}}} | http://wiki.ubuntu.org.cn/UbuntuHelp:AptProxy }} |
点击翻译: |
English {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/af | • {{#if: zh-hans|Afrikaans| [[::AptProxy/zh/af|Afrikaans]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/ar | • {{#if: zh-hans|العربية| [[::AptProxy/zh/ar|العربية]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/az | • {{#if: zh-hans|azərbaycanca| [[::AptProxy/zh/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/bcc | • {{#if: zh-hans|جهلسری بلوچی| [[::AptProxy/zh/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/bg | • {{#if: zh-hans|български| [[::AptProxy/zh/bg|български]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/br | • {{#if: zh-hans|brezhoneg| [[::AptProxy/zh/br|brezhoneg]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/ca | • {{#if: zh-hans|català| [[::AptProxy/zh/ca|català]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/cs | • {{#if: zh-hans|čeština| [[::AptProxy/zh/cs|čeština]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/de | • {{#if: zh-hans|Deutsch| [[::AptProxy/zh/de|Deutsch]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/el | • {{#if: zh-hans|Ελληνικά| [[::AptProxy/zh/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/es | • {{#if: zh-hans|español| [[::AptProxy/zh/es|español]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/fa | • {{#if: zh-hans|فارسی| [[::AptProxy/zh/fa|فارسی]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/fi | • {{#if: zh-hans|suomi| [[::AptProxy/zh/fi|suomi]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/fr | • {{#if: zh-hans|français| [[::AptProxy/zh/fr|français]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/gu | • {{#if: zh-hans|ગુજરાતી| [[::AptProxy/zh/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/he | • {{#if: zh-hans|עברית| [[::AptProxy/zh/he|עברית]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/hu | • {{#if: zh-hans|magyar| [[::AptProxy/zh/hu|magyar]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/id | • {{#if: zh-hans|Bahasa Indonesia| [[::AptProxy/zh/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/it | • {{#if: zh-hans|italiano| [[::AptProxy/zh/it|italiano]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/ja | • {{#if: zh-hans|日本語| [[::AptProxy/zh/ja|日本語]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/ko | • {{#if: zh-hans|한국어| [[::AptProxy/zh/ko|한국어]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/ksh | • {{#if: zh-hans|Ripoarisch| [[::AptProxy/zh/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/mr | • {{#if: zh-hans|मराठी| [[::AptProxy/zh/mr|मराठी]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/ms | • {{#if: zh-hans|Bahasa Melayu| [[::AptProxy/zh/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/nl | • {{#if: zh-hans|Nederlands| [[::AptProxy/zh/nl|Nederlands]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/no | • {{#if: zh-hans|norsk| [[::AptProxy/zh/no|norsk]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/oc | • {{#if: zh-hans|occitan| [[::AptProxy/zh/oc|occitan]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/pl | • {{#if: zh-hans|polski| [[::AptProxy/zh/pl|polski]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/pt | • {{#if: zh-hans|português| [[::AptProxy/zh/pt|português]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/ro | • {{#if: zh-hans|română| [[::AptProxy/zh/ro|română]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/ru | • {{#if: zh-hans|русский| [[::AptProxy/zh/ru|русский]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/si | • {{#if: zh-hans|සිංහල| [[::AptProxy/zh/si|සිංහල]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/sq | • {{#if: zh-hans|shqip| [[::AptProxy/zh/sq|shqip]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/sr | • {{#if: zh-hans|српски / srpski| [[::AptProxy/zh/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/sv | • {{#if: zh-hans|svenska| [[::AptProxy/zh/sv|svenska]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/th | • {{#if: zh-hans|ไทย| [[::AptProxy/zh/th|ไทย]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/tr | • {{#if: zh-hans|Türkçe| [[::AptProxy/zh/tr|Türkçe]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/vi | • {{#if: zh-hans|Tiếng Việt| [[::AptProxy/zh/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/yue | • {{#if: zh-hans|粵語| [[::AptProxy/zh/yue|粵語]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/zh | • {{#if: zh-hans|中文| [[::AptProxy/zh/zh|中文]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/zh-hans | • {{#if: zh-hans|中文(简体)| [[::AptProxy/zh/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: zh-hans | zh-hans | {{#if: | :}}AptProxy/zh}}/zh-hant | • {{#if: zh-hans|中文(繁體)| [[::AptProxy/zh/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:zh-hans|:AptProxy/zh|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :AptProxy/zh/zh | | {{#ifexist: AptProxy/zh/zh | | {{#ifeq: {{#titleparts:AptProxy/zh|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:AptProxy/zh|1|-1|}} | zh | | }}
简述
apt-proxy
程序将你从网络上下载下来的软件包缓存到本地磁盘。apt-proxy的行为就像一台包含那些你所选择软件包全部拷贝的HTTP服务器。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 已经包含在通用档案文件中。要安装,在终端中运行命令:
sudo apt-get install apt-proxy
配置apt-proxy服务器
默认设置
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:
[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.