个人工具

AptMoveHowTo

来自Ubuntu中文

Oneleaf讨论 | 贡献2007年5月30日 (三) 18:53的版本 (新页面: == 使用 apt-move 创建软件库光盘 == 原文出处:https://help.ubuntu.com/community/AptMoveHowto 原文作者:周正(ZhouZheng) 授权许可: * [http://creativecommons.or...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索

使用 apt-move 创建软件库光盘

原文出处:https://help.ubuntu.com/community/AptMoveHowto

原文作者:周正(ZhouZheng)

授权许可:

翻译人员:周正(ZhouZheng)

校正人员:

贡献人员:

适用版本:Ubuntu 6.06 文章状态:等待校正




For breezy (Ubuntu 5.10) see: AptMoveHowto/breezy

如果您使用的是breezy (Ubuntu 5.10)请参见: AptMoveHowto/breezy

This page will describe how to make a cd which contains packages you have downloaded on one machine using apt or synaptic. The cd will be a repository that you can easily use on another machine using synaptic or apt-cdrom.

本文将描述如何刻录一张带使用apt或synaptic下载的软件包的CD光盘。这张CD光盘将会是一张可以直接为其它机器的synaptic或apt-cdrom所用的软件仓库。

For example, I will show how to make a cd which contains all the security updates that has been downloaded.

例如,我将演示如何制作一张包含所有以下载的安全升级的CD光盘。

Except for adding new apt PGP keys, the user of the cd will not need to use the command-line to use it.

除了添加新的apt PGP keys以外,这张CD光盘的使用者将无需做任何的命令行操作。

Step 1: Install the apt-move package(安装apt-move软件包)

Apt-move is a tool for creating a debian package repository file structure out of packages that have been downloaded to /var/cache/apt/archives. Installed packages are downloded there by apt for installation. Apt-move will create this local repository in /mirrors/debian, by default.

Apt-move是一个专为已下载到/var/cache/apt/archives的软件包生成debian软件包仓库文件结构的工具。 为了便于安装,apt会将已安装的软件包下载到本地。 Apt-move将默认在/mirrors/debian中生成这个本地仓库。

sudo aptitude install apt-move

(Or just use synaptic) You need to enable the universe repository. See AddingRepositoriesHowto

(或者使用synaptic) 你需要激活universe仓库。参见AddingRepositoriesHowto

I change the setting in /etc/apt-move.conf from

我将/etc/apt-move.conf中的设置从

COPYONLY=no

to 变为

COPYONLY=yes

So that apt-move doesn't delete file from your /var/cache/apt/archives/.

以便apt-move不会删除/var/cache/apt/archives/中的软件包。


Step 2: Select the packages you want to put on the cd(选择您要刻录到CD上的软件包)

In this example, we only want to put freshly downloaded packages. We don't want to put old packages or packages that exist in Ubuntu CD.

在这个实例中,我们仅希望刻录下载的最新的软件包。我们不想刻录旧的或Ubuntu CD上已存在的软件包。

First, we clean up the /var/cache/apt/archives from old packages.

首先,我们清除/var/cache/apt/archives 中旧的软件包。

sudo aptitude autoclean

Step 3: Run apt move to create the archive structure(运行apt move创建文档结构)

Make sure you have enough disk space first.

首先确定你有足够的硬盘空间。

Because /mirrors/debian is root owned we must become root to make the steps easier.

由于/mirrors/debian归root所有,我们必须使用root账户,以便于这一步的操作

sudo -s

All the following command run as root.

下面的所有命令均以root身份运行。

First we clean-up previous mirrors (if exists) then we run apt-move.

先我们清空先前的镜像(如果存在的话),然后我的运行apt-move。

rm -rf /mirrors/debian
apt-move -d dapper update

Because ubuntu repository structure, not all packages are inserted into the Packages.gz file by apt-move. We must remake Packages.gz with the help of apt-ftparchive.

由于ubuntu的仓库结构,apt-move并不是把所有的软件包都插入到Packages.gz文件中。我们必须在apt-ftparchive的帮助下重新制作Packages.gz。

cd /mirrors/debian
apt-ftparchive packages pool/main/ \
| gzip -9c > dists/dapper/main/binary-i386/Packages.gz
apt-ftparchive packages pool/restricted/ \
| gzip -9c > dists/dapper/restricted/binary-i386/Packages.gz

We must also remake Release file, to do this we must make an apt configuration file named ~/myapt.conf it contents is like this

我们还必须重新制作Release文件。为了做到这一点,我们必须制作一个名为 ~/myapt.conf的apt配置文件。它的内容如下:

APT::FTPArchive::Release {
Origin "APT-Move";
Label "APT-Move";
Suite "dapper";
Codename "dapper";
Architectures "i386";
Components "main restricted";
Description "Ubuntu Updates CD";
};

Next, run the following commands:

然后,运行以下命令:

rm dists/dapper/Release
apt-ftparchive -c ~/myapt.conf release dists/dapper/ > Release
mv Release dists/dapper/

Then we need to make Release.gpg, to make it you must already have your GPGKey set and ready to sign.

现在,我们必要制作Release.gpg,为了做到这一点,你必须已经激活你的 GPGKey ,并已经开始签名。

gpg -bao dists/dapper/Release.gpg dists/dapper/Release

Next, we delete unwanted .apt-move directory

接下来,我们删除不想要的.apt-move目录

rm -rf .apt-move

You can identify the cd by making a .disk directory and making an info file in it.

你可以通过在CD上制作一个.disk目录和一个info文件来标识这个CD光盘。

mkdir .disk
echo Ubuntu-Updates `date +%Y-%m-%d` > .disk/info

Then we need to put our public keys in it.

然后,我们必要将我们的公钥放进去。

gpg --export -a "Your Name" > public.key

Offcourse change Your Name with the name that you use in your PGP.

当然,要把"Your Name"换成你在自己的PGP中使用的名字。

Thats' all

这样就完成了!

exit

Step 4: Burn the cd(刻录 CD 光盘)

Copy the contents of what is contained in /mirrors/debian to a cd.

复制/mirrors/debian中所有的内容到CD光盘上。

For example you could make an iso by following command:

例如,你可以使用下列的命令来制作一个iso文件:

mkisofs -r -A "Ubuntu Updates `date +%Y%m%d`" -o ubuntu-updates.iso \
/mirrors/debian

Before you could use the CD, you need to add our GPG key to apt GPG keys. Put the CD on CD-ROM Drive, mount it (if it not automatically mounted) then run the following:

在你使用这张CD前,你需要将我们的GPG key添加到apt GPG keys中去。将这张CD放入CD-ROM驱动器,挂载它(如果它不能自动挂载的话) ,然后运行如下命令:

apt-key add /cdrom/public.key

Then you could use the CD like any other Ubuntu CD.

此时,你就可以像其它的Ubuntu CD那样使用这张CD了。

On a non-networked ubuntu machine, you can run synaptic, insert the cd and go into Synaptic -> Edit -> Add Cdrom and it will add the contents of the cd to your repositories.

在一台未联网的ubuntu机器上,我可以运行synaptic,插入CD,并进入Synaptic -> 编辑 -> 添加Cdrom。它会将这张CD的内容添加到你的仓库中。

You can also do it from the command-line with

你也可以通过命令行方式来做到这一点:

sudo apt-cdrom add