AptMoveHowto

Differences between revisions 16 and 17
Revision 16 as of 2006-01-12 05:52:28
Size: 3236
Editor: 202
Comment: The redirection uses the ordinary user rights, not the su rights
Revision 17 as of 2006-01-14 12:12:13
Size: 4703
Editor: ip89-66
Comment: Make it really work on breezy
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
For example, I will show how to make a cd which contains the xubuntu-desktop package with all of it's dependencies. For example, I will show how to make a cd which contains all the security updates that has been downloaded.
Line 5: Line 5:
The user of the cd will not need to use the command-line to use it. Except for adding new apt PGP keys, the user of the cd will not need to use the command-line to use it.
Line 9: Line 9:
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, by default. 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.
Line 11: Line 11:
sudo apt-get install apt-move dpkg-dev sudo apt-get install apt-move
Line 18: Line 18:
Line 20: Line 19:
CONTENTS=no  COPYONLY=no
Line 24: Line 23:
CONTENTS=yes COPYONLY=yes
Line 26: Line 25:
So that a file with the contents of the packages will be created. So that apt-move doesn't delete file from your /var/cache/apt/archives/.
Line 28: Line 27:
= Step two Download the packages you want to put on the cd =
Line 30: Line 28:
In this example, we are starting from a ''freshly-installed system''. We need to clean out the cache of packages in /var/cache/apt/archive. If you have already installed other packages, be sure that you leave them there so that they are put on your custom cd. If unsure about what dependancies you already have installed, ''perhaps this can be done from the live cd''? = Step two Select the packages you want to put on the cd =
Line 32: Line 30:
So, delete every package in /var/cache/apt/archives. Do not delete these files manually! Instead use: 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.
Line 34: Line 32:
{{{sudo apt-get clean First, we clean up the /var/cache/apt/archives from old packages.
{{{
sudo apt-get autoclean
Line 37: Line 37:
And then install (or just download the xubuntu-desktop packages)
Next, we delete packages that exists in the Ubuntu CD. Put your Ubuntu CD on CD-ROM Drive then run the following:
Line 40: Line 39:
sudo apt-get -d install xubuntu-desktop for f in `find /media/cdrom/pool/ -name '*.deb' -printf %f\\n`
do
  if [ -f /var/cache/apt/archives/$f ]; then
    sudo rm -v /var/cache/apt/archives/$f
  fi
done
Line 42: Line 46:

This will put the packages in /var/cache/apt/archives. Apt-move will look there by default.
Line 49: Line 51:

{{{sudo apt-move get
sudo apt-move move
sudo apt-move packages
Because /mirrors/debian is root owned we must become root to make the steps easier.
{{{
sudo -s
Line 55: Line 56:
It would seem that some ubuntu packages are not inserted into the packages.gz file by apt-move. Is this because of some ubuntu-specific reposiitory structure? You must delete the Packages.gz file and remake it with dpkg-scanpackages. Make the directory writable and then cd into it and run: All the following command run as root:
Line 58: Line 59:
cd /mirrors/debian/dists/stable/main/binary-i386 rm -rf /mirrors/debian
apt-move -d breezy update
}}}
Line 60: Line 63:
sudo sh -c "dpkg-scanpackages ../../../../pool/ /dev/null > Packages" 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.

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

We must also remake Release file:
{{{
apt-ftparchive release dists/breezy/ >> dists/breezy/Release
}}}

Next, edit the Release file so it looks like this:
{{{
Origin: APT-Move
Label: APT-Move
Suite: breezy
Codename: breezy
Date: Sat, 14 Jan 2006 08:49:42 UTC
Architectures: i386
Components: main
Description: Ubuntu-Updates
MD5Sum:
 cf3c2af8788837055411304a1a67bc33 32703 main/binary-i386/Packages.gz
 8441b8013080986d418764ff332ed520 84 main/binary-i386/Release
 b6aa558537081fab561ecf8394ef222d 2006 restricted/binary-i386/Packages.gz
 e592633392ed258f5a2612567f0a2373 90 restricted/binary-i386/Release
SHA1:
 ba71033fe43887d53133105a7ebd4ccfcc46d099 32703 main/binary-i386/Packages.gz
 8c3ffb334d44d4189b42fa11277fcf8630a1c988 84 main/binary-i386/Release
 2d0dc5e049a785d09fdd211b13ed9a90451ecea2 2006 restricted/binary-i386/Packages.gz
 7b96af30236517786c4b17b2292c893250d40ac2 90 restricted/binary-i386/Release
}}}

Then we need to make Release.gpg, to make it you must already have [[GPG]] set and ready to sign.

{{{
gpg -bao dists/breezy/Release.gpg dists/breezy/Release
}}}

Next, we delete unwanted .apt-move directory
{{{
rm -rf .apt-move
Line 65: Line 113:
Make the /mirrors/debian direcory writable and do {{{
mkdir .disk
echo Ubuntu-Updates `date +%Y-%m-%d` > .disk/info
}}}
Line 67: Line 118:
{{{mkdir /mirrors/debian/.disk
echo "Custom packages" $(hostname) $(date +%y%m%d) > /mirrors/debian/.disk/info
Then we need to put our public keys in it.

{{{
gpg --export -a "Zakaria" > public.key
}}}

Thats' all
{{{
exit
Line 73: Line 131:
Copy the contents of what is contained in /mirrors/debian to a cd.
Line 74: Line 133:
Copy the contents of what is contained in /mirrors/debian to a cd. For example you could make an iso by following command:
{{{
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.

{{{
mount /cdrom
apt-key add /cdrom/public.key
umount /cdrom
}}}
Line 81: Line 152:
sudo apt-cdrom add}}} sudo apt-cdrom add
}}}
Line 83: Line 155:
** To DO:
 * Add an override file so that you can use pinning on the offline repository packages.
Line 86: Line 156:
CategoryDocumentation CategoryCleanup CategoryDocumentation

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.

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

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

Step one Install the apt-move package

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.

sudo apt-get install apt-move

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

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

COPYONLY=no

to

COPYONLY=yes

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

Step two Select the packages you want to put on the 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.

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

sudo apt-get autoclean

Next, we delete packages that exists in the Ubuntu CD. Put your Ubuntu CD on CD-ROM Drive then run the following:

for f in `find /media/cdrom/pool/ -name '*.deb' -printf %f\\n`
do
  if [ -f /var/cache/apt/archives/$f ]; then
    sudo rm -v /var/cache/apt/archives/$f
  fi
done

Step three Run apt move to create the archive structure

Make sure you have enough disk space first.

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

sudo -s

All the following command run as root:

rm -rf /mirrors/debian
apt-move -d breezy 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.

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

We must also remake Release file:

apt-ftparchive release dists/breezy/ >> dists/breezy/Release

Next, edit the Release file so it looks like this:

Origin: APT-Move
Label: APT-Move
Suite: breezy
Codename: breezy
Date: Sat, 14 Jan 2006 08:49:42 UTC
Architectures: i386
Components: main
Description: Ubuntu-Updates
MD5Sum:
 cf3c2af8788837055411304a1a67bc33            32703 main/binary-i386/Packages.gz
 8441b8013080986d418764ff332ed520               84 main/binary-i386/Release
 b6aa558537081fab561ecf8394ef222d             2006 restricted/binary-i386/Packages.gz
 e592633392ed258f5a2612567f0a2373               90 restricted/binary-i386/Release
SHA1:
 ba71033fe43887d53133105a7ebd4ccfcc46d099            32703 main/binary-i386/Packages.gz
 8c3ffb334d44d4189b42fa11277fcf8630a1c988               84 main/binary-i386/Release
 2d0dc5e049a785d09fdd211b13ed9a90451ecea2             2006 restricted/binary-i386/Packages.gz
 7b96af30236517786c4b17b2292c893250d40ac2               90 restricted/binary-i386/Release

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

gpg -bao dists/breezy/Release.gpg dists/breezy/Release

Next, we delete unwanted .apt-move directory

rm -rf .apt-move

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

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

Then we need to put our public keys in it.

gpg --export -a "Zakaria" > public.key

Thats' all

exit

Step four Burn the cd

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

For example you could make an iso by following command:

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.

mount /cdrom
apt-key add /cdrom/public.key
umount /cdrom

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.

You can also do it from the command-line with

sudo apt-cdrom add

CategoryDocumentation

AptMoveHowto (last edited 2008-08-06 16:19:39 by localhost)