還是起了原來的標題名稱,今天在找內(nèi)網(wǎng)Ubuntu系統(tǒng)更新的方案時,看到了網(wǎng)站上的一篇帖子,很是興奮??赡脕硪豢磪s發(fā)現(xiàn)這個apt-proxy的東東已經(jīng)不在ubuntu 12.04(LTS)的發(fā)布版本里了,看來這篇帖子又是有點跟不上潮流的那種。查了一下資料,目前發(fā)布版本中提供了approx。官方的描述如下:
Approx is an HTTP-based proxy server for Debian-style package archives. It fetches files from remote repositories on demand, and caches them for local use.
Approx saves time and network bandwidth if you need to install or upgrade .deb packages for a number of machines on a local network. Each package is downloaded from a remote site only once, regardless of how many local clients install it. The approx cache typically requires a few gigabytes of disk space.
Approx also simplifies the administration of client machines: repository locations need only be changed in approx's configuration file, not in every client's /etc/apt/sources.list file.
Approx can be used as a replacement for apt-proxy, with no need to modify clients' /etc/apt/sources.list files, or as an alternative to apt-cacher.
approx看來確實是替代了apt-proxy,在10.04之后就不再提供apt-proxy了。
approx部署起來也是簡單至極,首先部署approx:
sudo apt-get install approx
通過下邊的指令獲取當前/etc/apt/sources.list中的更新地址
$ grep -E "^[^#]" sources.list | cut -d " " -f2 | uniq
配置/etc/approx/approx.conf文件,添加如下內(nèi)容
ubuntu
ubuntu-extras
ubuntu-partner
ubuntu-security
$ sudo /etc/init.d/openbsd-inetd restart
* Restarting internet superserver inetd [ OK ]
重新啟動之后,服務(wù)就已經(jīng)在9999端口運行了。
在客戶端的配置,其實就是把客戶端的/etc/apt/sources.list文件變更為你approx的地址就可以了:
deb :9999/ubuntu/ precise main restricted
deb-src :9999/ubuntu/ precise main restricted
deb :9999/ubuntu/ precise-updates main restricted
deb-src :9999/ubuntu/ precise-updates main restricted
deb :9999/ubuntu/ precise universe
deb-src :9999/ubuntu/ precise universe
deb :9999/ubuntu/ precise-updates universe
deb-src :9999/ubuntu/ precise-updates universe
deb :9999/ubuntu/ precise multiverse
deb-src :9999/ubuntu/ precise multiverse
deb :9999/ubuntu/ precise-updates multiverse
deb-src :9999/ubuntu/ precise-updates multiverse
deb :9999/ubuntu/ precise-backports main restricted universe multiverse
deb-src :9999/ubuntu/ precise-backports main restricted universe multiverse
deb :9999/ubuntu precise-security main restricted
deb-src :9999/ubuntu precise-security main restricted
deb :9999/ubuntu precise-security universe
deb-src :9999/ubuntu precise-security universe
deb :9999/ubuntu precise-security multiverse
deb-src :9999/ubuntu precise-security multiverse
其他地址就可以刪除掉了。剩下的就是sudo apt-get update ~~~