特殊:Badtitle/NS100:HttpReplicator:修订间差异
小 新页面: {{From|https://help.ubuntu.com/community/HttpReplicator}} {{Languages|UbuntuHelp:HttpReplicator}} == Guide for setting up http-replicator, a download cache (proxy) for Ubuntu packages == ... |
小无编辑摘要 |
||
第3行: | 第3行: | ||
== Guide for setting up http-replicator, a download cache (proxy) for Ubuntu packages == | == Guide for setting up http-replicator, a download cache (proxy) for Ubuntu packages == | ||
http-replicator is a powerful Python-based proxy or download cache | http-replicator is a powerful Python-based proxy or download cache capable of caching any traffic over http. It's best when used for a network of Ubuntu machines, saving bandwidth and increasing the speed with which updates are obtained by all machines. | ||
'''NOTE:''' | '''NOTE:''' | ||
第18行: | 第13行: | ||
</nowiki></pre> | </nowiki></pre> | ||
If, when you download and install this, dpkg attempts to start http-replicator and then complains of not being able to find the command source, it's because /bin/sh in Edgy Eft does not default to bash (As far as I can see). You will need to edit /etc/init.d/http-replicator by doing | If, when you download and install this, dpkg attempts to start http-replicator and then complains of not being able to find the command source, it's because /bin/sh in Edgy Eft and later releases does not default to bash (As far as I can see). You will need to edit /etc/init.d/http-replicator by doing | ||
<pre><nowiki> | <pre><nowiki> | ||
sudo | sudo sensible-editor /etc/init.d/http-replicator | ||
</nowiki></pre> | </nowiki></pre> | ||
第43行: | 第38行: | ||
<pre><nowiki> | <pre><nowiki> | ||
sudo | sudo sensible-editor /etc/default/http-replicator | ||
</nowiki></pre> | </nowiki></pre> | ||
第59行: | 第54行: | ||
Its probably worth noting that ? and * are wildcards supported by http-replicator. You can make it accept connections from one host (or multiple hosts if you use --ip= more then once) or an entire subnet (as above). | Its probably worth noting that ? and * are wildcards supported by http-replicator. You can make it accept connections from one host (or multiple hosts if you use --ip= more then once) or an entire subnet (as above). | ||
The other change you might like to do is change the port to 80. What this will do is make http-replicator cache all web trafic, without requiring you to reconfigure any client settings at all. | |||
Your resultant line will look something like: | |||
<pre><nowiki> | |||
DAEMON_OPTS="$GENERAL_OPTS --port 80 --log /var/log/http-replicator.log --user proxy --ip=192.168.0.*" | |||
</nowiki></pre> | |||
Then remove the line that says | Then remove the line that says | ||
第74行: | 第75行: | ||
And you're finished with the proxy! | And you're finished with the proxy! | ||
Now, all you have to do is get the clients ready. (The example given below is for proxying packages downloaded by APT). | Now, all you have to do is get the clients ready. Note that if you changed the port http-replicator runs on to port 80, the following is unneeded. (The example given below is for proxying packages downloaded by APT). | ||
On the local computer you want to use http-replicator with, add this line to /etc/apt/apt.conf | On the local computer you want to use http-replicator with, add this line to /etc/apt/apt.conf |
2007年11月22日 (四) 13:06的版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/HttpReplicator }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/af | • {{#if: UbuntuHelp:HttpReplicator|Afrikaans| [[::HttpReplicator/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/ar | • {{#if: UbuntuHelp:HttpReplicator|العربية| [[::HttpReplicator/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/az | • {{#if: UbuntuHelp:HttpReplicator|azərbaycanca| [[::HttpReplicator/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/bcc | • {{#if: UbuntuHelp:HttpReplicator|جهلسری بلوچی| [[::HttpReplicator/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/bg | • {{#if: UbuntuHelp:HttpReplicator|български| [[::HttpReplicator/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/br | • {{#if: UbuntuHelp:HttpReplicator|brezhoneg| [[::HttpReplicator/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/ca | • {{#if: UbuntuHelp:HttpReplicator|català| [[::HttpReplicator/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/cs | • {{#if: UbuntuHelp:HttpReplicator|čeština| [[::HttpReplicator/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/de | • {{#if: UbuntuHelp:HttpReplicator|Deutsch| [[::HttpReplicator/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/el | • {{#if: UbuntuHelp:HttpReplicator|Ελληνικά| [[::HttpReplicator/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/es | • {{#if: UbuntuHelp:HttpReplicator|español| [[::HttpReplicator/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/fa | • {{#if: UbuntuHelp:HttpReplicator|فارسی| [[::HttpReplicator/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/fi | • {{#if: UbuntuHelp:HttpReplicator|suomi| [[::HttpReplicator/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/fr | • {{#if: UbuntuHelp:HttpReplicator|français| [[::HttpReplicator/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/gu | • {{#if: UbuntuHelp:HttpReplicator|ગુજરાતી| [[::HttpReplicator/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/he | • {{#if: UbuntuHelp:HttpReplicator|עברית| [[::HttpReplicator/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/hu | • {{#if: UbuntuHelp:HttpReplicator|magyar| [[::HttpReplicator/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/id | • {{#if: UbuntuHelp:HttpReplicator|Bahasa Indonesia| [[::HttpReplicator/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/it | • {{#if: UbuntuHelp:HttpReplicator|italiano| [[::HttpReplicator/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/ja | • {{#if: UbuntuHelp:HttpReplicator|日本語| [[::HttpReplicator/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/ko | • {{#if: UbuntuHelp:HttpReplicator|한국어| [[::HttpReplicator/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/ksh | • {{#if: UbuntuHelp:HttpReplicator|Ripoarisch| [[::HttpReplicator/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/mr | • {{#if: UbuntuHelp:HttpReplicator|मराठी| [[::HttpReplicator/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/ms | • {{#if: UbuntuHelp:HttpReplicator|Bahasa Melayu| [[::HttpReplicator/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/nl | • {{#if: UbuntuHelp:HttpReplicator|Nederlands| [[::HttpReplicator/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/no | • {{#if: UbuntuHelp:HttpReplicator|norsk| [[::HttpReplicator/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/oc | • {{#if: UbuntuHelp:HttpReplicator|occitan| [[::HttpReplicator/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/pl | • {{#if: UbuntuHelp:HttpReplicator|polski| [[::HttpReplicator/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/pt | • {{#if: UbuntuHelp:HttpReplicator|português| [[::HttpReplicator/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/ro | • {{#if: UbuntuHelp:HttpReplicator|română| [[::HttpReplicator/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/ru | • {{#if: UbuntuHelp:HttpReplicator|русский| [[::HttpReplicator/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/si | • {{#if: UbuntuHelp:HttpReplicator|සිංහල| [[::HttpReplicator/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/sq | • {{#if: UbuntuHelp:HttpReplicator|shqip| [[::HttpReplicator/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/sr | • {{#if: UbuntuHelp:HttpReplicator|српски / srpski| [[::HttpReplicator/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/sv | • {{#if: UbuntuHelp:HttpReplicator|svenska| [[::HttpReplicator/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/th | • {{#if: UbuntuHelp:HttpReplicator|ไทย| [[::HttpReplicator/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/tr | • {{#if: UbuntuHelp:HttpReplicator|Türkçe| [[::HttpReplicator/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/vi | • {{#if: UbuntuHelp:HttpReplicator|Tiếng Việt| [[::HttpReplicator/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/yue | • {{#if: UbuntuHelp:HttpReplicator|粵語| [[::HttpReplicator/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/zh | • {{#if: UbuntuHelp:HttpReplicator|中文| [[::HttpReplicator/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/zh-hans | • {{#if: UbuntuHelp:HttpReplicator|中文(简体)| [[::HttpReplicator/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:HttpReplicator | UbuntuHelp:HttpReplicator | {{#if: | :}}HttpReplicator}}/zh-hant | • {{#if: UbuntuHelp:HttpReplicator|中文(繁體)| [[::HttpReplicator/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:HttpReplicator|:HttpReplicator|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :HttpReplicator/zh | | {{#ifexist: HttpReplicator/zh | | {{#ifeq: {{#titleparts:HttpReplicator|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:HttpReplicator|1|-1|}} | zh | | }}
Guide for setting up http-replicator, a download cache (proxy) for Ubuntu packages
http-replicator is a powerful Python-based proxy or download cache capable of caching any traffic over http. It's best when used for a network of Ubuntu machines, saving bandwidth and increasing the speed with which updates are obtained by all machines.
NOTE: The deb available from the freshmeat page for this package is older then the one here, so please use the one given below.
wget http://gertjan.freezope.org/replicator/http-replicator_3.0_i386.deb sudo dpkg -i http-replicator_3.0_i386.deb
If, when you download and install this, dpkg attempts to start http-replicator and then complains of not being able to find the command source, it's because /bin/sh in Edgy Eft and later releases does not default to bash (As far as I can see). You will need to edit /etc/init.d/http-replicator by doing
sudo sensible-editor /etc/init.d/http-replicator
Change
#! /bin/sh
in the first line to
#! /bin/bash
Unfortunately, this .deb doesn't create and do everything it needs to by default, so we need to create the cache for the files and give ownership of the cache to the http-replicator daemon.
sudo mkdir /var/cache/http-replicator sudo chown proxy.root /var/cache/http-replicator
Now, to configure the proxy, open up the config file with
sudo sensible-editor /etc/default/http-replicator
Look at the line
DAEMON_OPTS="$GENERAL_OPTS --port 8080 --log /var/log/http-replicator.log --user proxy"
And change it to
DAEMON_OPTS="$GENERAL_OPTS --port 8080 --log /var/log/http-replicator.log --user proxy --ip=192.168.0.*"
`--ip=192.168.0.*`is whatever network address space your using.
Its probably worth noting that ? and * are wildcards supported by http-replicator. You can make it accept connections from one host (or multiple hosts if you use --ip= more then once) or an entire subnet (as above).
The other change you might like to do is change the port to 80. What this will do is make http-replicator cache all web trafic, without requiring you to reconfigure any client settings at all. Your resultant line will look something like:
DAEMON_OPTS="$GENERAL_OPTS --port 80 --log /var/log/http-replicator.log --user proxy --ip=192.168.0.*"
Then remove the line that says
exit 0 # REMOVE THIS LINE TO ACTIVATE THE PROXY SERVER
Save the file and exit.
Restart the daemon (or start for the first time)
sudo /etc/init.d/http-replicator restart
And you're finished with the proxy!
Now, all you have to do is get the clients ready. Note that if you changed the port http-replicator runs on to port 80, the following is unneeded. (The example given below is for proxying packages downloaded by APT).
On the local computer you want to use http-replicator with, add this line to /etc/apt/apt.conf
Acquire::http::Proxy "http://192.168.0.1:8080";
Replace 192.168.0.1 with the IP of the server http-replicator is running on.
More info:
man 1 http-replicator
man 1 http-replicator_maintenance
http://gertjan.freezope.org/replicator/
For the record, the following files are installed by the .deb
./ usr/ usr/share/ usr/share/doc/ usr/share/doc/http-replicator/ usr/share/doc/http-replicator/README.gz usr/share/doc/http-replicator/copyright usr/share/doc/http-replicator/examples/ usr/share/doc/http-replicator/examples/apt.conf usr/share/doc/http-replicator/changelog.gz usr/share/man/ usr/share/man/man1/ usr/share/man/man1/http-replicator.1.gz usr/share/man/man1/http-replicator_maintenance.1.gz usr/bin/ usr/bin/http-replicator usr/bin/http-replicator_maintenance etc/ etc/logrotate.d/ etc/logrotate.d/http-replicator etc/default/ etc/default/http-replicator etc/init.d/ etc/init.d/http-replicator etc/cron.weekly/ etc/cron.weekly/http-replicator