LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1266|回复: 7

如何做arch的镜像,文件下载后如何同步更新啊

[复制链接]
发表于 2006-1-13 20:00:51 | 显示全部楼层 |阅读模式
如题,我想做一个arch的镜像资源,文件要一个一的下载啊,有什么工具可以同步更新啊,批量下载管理阿
发表于 2006-1-13 20:27:50 | 显示全部楼层
http://wiki.archlinux.org/index.php/Local_Mirror

How to set up a local mirror

This document describes how to create a mirror on your local machine of all the files on the Arch mirrors of the "current" and "extra" directories, how to make it update periodically and how to set up pacman to use the local files.

    * Of course, make sure that you're up-to-date:
[php]
  pacman -Syu
[/php]

    * Now, install rsync:
[php]
  pacman -S rsync
[/php]

    * Create a directory to host the mirrored files. As of March 2005, "current" requires a little over 500 MB while "extra" weighs around 2.2 GB. You can also mirror "testing" (800 MB) and "unstable" (350 MB) if you wish to. Also change permissions so an unprivileged user (in our example "chris") owns the folders.
[php]
  mkdir -p /mirror/{current,extra}
  # mkdir /mirror/{testing,unstable}
  chown -R chris /mirror
[/php]

    * Fire up your favourite editor and create a file named /mirror/sync.sh with the following content. If you want to mirror "testing" and "unstable" as well, comment out the corresponding lines. You may also adjust the address of the mirror to one geographically close to you.
[php]
  #!/bin/sh
  rsync -avz --delete rsync.archlinux.org::current /mirror/current/
  rsync -avz --delete rsync.archlinux.org::extra /mirror/extra/
  # --delete to delete old files remove it if you want to keep them
  # rsync -avz --delete rsync.archlinux.org::ftp/testing /mirror/
  # rsync -avz --delete rsync.archlinux.org::ftp/unstable /mirror/
[/php]

    * Make the newly created script executable:
[php]
  chmod a+x /mirror/sync.sh
[/php]

    * Make sure dcron is installed (it should already be):
[php]
  pacman -Q dcron
[/php]

    * Create a cron script with the name /etc/cron.daily/sync and the following content, and replace "chris" with the name of an unprivileged user on your system:
[php]
  #!/bin/sh
  SYNCLOGFILE="/var/log/sync.log"
  SYNCLOCKFILE="/var/lock/sync.lock"

  if [[ -f $SYNCLOCKFILE ]]; then
    # lock file already present, bail
    exit 1
  fi

  echo -n ">>> Sync log for " > $SYNCLOGFILE
  date >> $SYNCLOGFILE

  cd /mirror
  touch $SYNCLOCKFILE
  su - chris -c "/mirror/sync.sh" >> $SYNCLOGFILE
  rm -f $SYNCLOCKFILE
[/php]
  

    * Set permissions:
[php]
  chmod 744 /etc/cron.daily/sync
[/php]

Now the mirror will be synchronized at 00:02 AM everyday. What's now left to do is to tell our system to actually make use of the local mirror.

    * Modify the file /etc/pacman.d/current so that it looks like this:
[php]
  #
  # CURRENT: Arch Linux core repository
  #
  [[current]]
  Server = file:///mirror/current/os/i686
  Server = ftp://ftp.archlinux.org/current/os/i686
  # Also include the rest of the mirrors if you want
[/php]

    * Modify the file /etc/pacman.d/extra so that it looks like this:
[php]
  #
  # The Extra Repository
  #
  [[extra]]
  Server = file:///mirror/extra/os/i686
  Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/extra/os/i686
  # Also include the rest of the mirrors if you want
[/php]

    * Do the same for the "testing" and "unstable" files if you decided to mirror those as well.

    * Wait for the first sync to finish (check /var/log/sync.log), then try and see if it works:
[php]
  pacman -Sy
[/php]

    * That should yield something like this:
[php]
  :: Synchronizing package databases...
   current                  [[/mirror/current/os/i686/]] 100%    LOCAL
   extra                    [[/mirror/extra/os/i686/]] 100%    LOCAL
[/php]

That's it!

I'd appreciate any comments and suggestions in IRC, my nick is busfahrer and I'm on #archlinux on irc.freenode.net
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-1-13 20:56:19 | 显示全部楼层
thank you
回复 支持 反对

使用道具 举报

发表于 2006-1-13 21:00:10 | 显示全部楼层
Post by hehehi
thank you


你也可以干脆用wget -m。只是有些镜像不支持。
回复 支持 反对

使用道具 举报

发表于 2006-1-13 23:10:29 | 显示全部楼层
好贴, 够详细. 再过两周朋友淘汰给我一台PII, 做个mirror试一试。
回复 支持 反对

使用道具 举报

发表于 2006-1-14 08:31:12 | 显示全部楼层
Post by biinn
好贴, 够详细. 再过两周朋友淘汰给我一台PII, 做个mirror试一试。


想了解东西的时候,多去官方wiki看看:)
回复 支持 反对

使用道具 举报

发表于 2006-1-14 08:51:24 | 显示全部楼层
http://wiki.archlinux.org/index. ... 0%E9%95%9C%E5%83%8F

翻译了一下。

同时建议以后翻译就直接留官方的wiki链接好了。
回复 支持 反对

使用道具 举报

发表于 2006-1-14 09:00:34 | 显示全部楼层
Post by wd_afei
http://wiki.archlinux.org/index. ... 0%E9%95%9C%E5%83%8F

翻译了一下。

同时建议以后翻译就直接留官方的wiki链接好了。


nice work !
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表