讓內網Ubuntu系統更新更輕鬆

來源:互聯網
上載者:User

還是起了原來的標題名稱(見  ),今天在找內網Ubuntu系統更新的方案時,看到了網站上的一篇文章,很是興奮。可拿來一看卻發現這個apt-proxy的東東已經不在Ubuntu 12.04(LTS)的發布版本裡了,看來這篇文章又是有點跟不上潮流的那種。查了一下資料,目前發布版本中提供了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
http://au.archive.ubuntu.com/ubuntu/
http://security.ubuntu.com/ubuntu 配置/etc/approx/approx.conf檔案,添加如下內容


ubuntu    http://cn.archive.ubuntu.com/ubuntu
ubuntu-extras    http://extras.ubuntu.com/ubuntu
ubuntu-partner    http://archive.canonical.com/ubuntu
ubuntu-security    http://security.ubuntu.com/ubuntu

$ sudo /etc/init.d/openbsd-inetd restart
 * Restarting internet superserver inetd                                  [ OK ]


重新啟動之後,服務就已經在9999連接埠運行了。
 
在用戶端的配置,其實就是把用戶端的/etc/apt/sources.list檔案變更為你approx的地址就可以了:
 
deb http://approx:9999/ubuntu/ precise main restricted
deb-src http://approx:9999/ubuntu/ precise main restricted
deb http://approx:9999/ubuntu/ precise-updates main restricted
deb-src http://approx:9999/ubuntu/ precise-updates main restricted
deb http://approx:9999/ubuntu/ precise universe
deb-src http://approx:9999/ubuntu/ precise universe
deb http://approx:9999/ubuntu/ precise-updates universe
deb-src http://approx:9999/ubuntu/ precise-updates universe
deb http://approx:9999/ubuntu/ precise multiverse
deb-src http://approx:9999/ubuntu/ precise multiverse
deb http://approx:9999/ubuntu/ precise-updates multiverse
deb-src http://approx:9999/ubuntu/ precise-updates multiverse
deb http://approx:9999/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://approx:9999/ubuntu/ precise-backports main restricted universe multiverse
deb http://approx:9999/ubuntu precise-security main restricted
deb-src http://approx:9999/ubuntu precise-security main restricted
deb http://approx:9999/ubuntu precise-security universe
deb-src http://approx:9999/ubuntu precise-security universe
deb http://approx:9999/ubuntu precise-security multiverse
deb-src http://approx:9999/ubuntu precise-security multiverse


其他地址就可以刪除掉了。剩下的就是sudo apt-get update ~~~

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.