Differences between revisions 103 and 104
Revision 103 as of 2013-05-16 11:38:50
Size: 16166
Editor: ?akshay khole
Comment:
Revision 104 as of 2013-05-20 06:57:29
Size: 16327
Editor: PaulWise
Comment: chdist/reprepro are better
Deletions are marked like this. Additions are marked like this.
Line 14: Line 14:

An alternative to the stuff below is to use an apt sources.list and chdist to download packages and then use reprepro to update the apt repository on the CD.

Translation(s): English - Russian(Русский)


Building a Custom Debian CD Set

An Easier Alternative

One possible "alternative" to this procedure is to use Simple-CDD. If it does everything you need for your custom CD, then there is no reason (except curiosity) to go through the rest of this article.

Introduction

This page describes how to create a partial debian mirror and the steps used to create a custom debian install cd using that mirror. This document shows how to use packages gathered from a prototype system's apt cache as well as a download script that starts with a list of packages and fetches the appropriate versions. The instructions here assume i386 but should work for any architecture simply by replacing i386 in the instructions with the architecture of your choice.

An alternative to the stuff below is to use an apt sources.list and chdist to download packages and then use reprepro to update the apt repository on the CD.

Quick Overview, Using Apt, Binary Only

NOTE Using a full mirror, or a mostly full mirror is best practice. You should only use a partial mirror if you absolutely must (e.g. due to disk constraints) and realize that it is unsupported.

Create a mirror of the Debian archive for Apt

Option 1: Using debmirror

Frans Pop has created a wrapper script for this which is available from alioth. A README explains how to use it. This is the preferred approach.

Option 2: Create a partial mirror of the Debian archive

  • Download a DebianInstaller network install cd (netinst.iso) from here http://www.debian.org/CD/netinst/

  • Install Debian on a prototype system (Optional)

  • apt-get packages (or you may use Aptitude if you prefer) -> hint: you don't have to install, just download to the apt cache, as long apt-move works.

  • AptMove to a directory of your choice

  • Create a pool directory on the filesystem where you will build your new cd.

  • Copy the pool directory from network install cd to the directory you just created.
  • Copy from the directory to which you sent the files using apt-move to the pool directory (you could just AptMove to the pool directory).

  • Get installer-i386 from a debian mirror which is from the same release of DebianInstaller as your network install cd (unless you also build the installer and associated packages).

  • Get overrides.<dist>. files from http://<mirror>/debian/indices

  • Place in your debian-dir (i.e. the same directory as the pool directory you created above).
  • gunzip the overrides in the indices directory (you should probably keep the original gzipped versions too)

  • Generate packages files.
    • generate DebianInstaller packages files:

      • DebianInstaller lives in <debian-dir>/dists/<dist>/main/debian-installer/binary-i386, therefore

        • create the appropriate subdirectories (e.g. mkdir -p /debian/dists/sarge/main/debian-installer/binary-i386).

      • in a directory for your scripts and configuration files for this project create an apt.conf such as the one at DebianCustomCD/PoolAptConf

      • create a file named yourcdname-di.conf (or anything else, just substitute your filename as appropriate), such as the one at DebianCustomCD/PoolDebianInstallerPackagesGzConf, creating the directories described therein

      • execute the command  apt-ftparchive -c apt.conf generate yourcdname-di.conf 

    • repeat for binary-i386:
      • create another file named yourcdname.conf (such as the one at DebianCustomCD/PoolPackagesGzConf)

      • execute the command  apt-ftparchive -c apt.conf generate yourcdname.conf 

Create the actual CD set

Note that you must have a mirror of the debian archive which is usable by ?AptGet and which has the DebianInstaller binaries.

  • Create the list of packages you want on the cd (probably just a list of files in your pool dir).
  • Assuming you have debian-cd installed, follow the directions in /usr/share/debian-cd.
  • If you find you are missing dependencies, download the packages into your pool dir to correct that, regenerate your packages files, and start the debian-cd instructions over again (you may need to exit the shell you started the procedure in because debian-cd alters the environment while it builds the cd [set]).
  • Assuming successful completion of the CD building procedure, burn your CD and test.


Detailed Instructions

NOTE Using a full mirror, or a mostly full mirror is best practice. You should only use a partial mirror if you absolutely must (e.g. due to disk constraints) and realize that it is unsupported.

Preferred: Use debmirror

Frans Pop has created a wrapper script for this which is available from alioth. A README explains how to use it. This is the preferred approach if you have a high bandwidth connection and 30-40 GB of hard drive space to spare.

Optional: Create a partial mirror of the Debian archive for Apt (optional)

1. Getting Your Packages, Option 1

Pro: Will automatically resolve and download dependencies
Con: Only works for packages and dependencies not already installed

Get Your Base System (Optional)

The following will get you a system with no other packages installed, which can make figuring out what packages to include in your pool directory easier. (If you use apt-get to download the packages you want on your CD you will find that the dependencies for the packages will only also be downloaded if they are not already installed. If you are using another method figure out the list of packages to download then you don't need to worry about this).

  • Download a DebianInstaller network install CD (netinst.iso) from [WWW] http://www.debian.org/CD/netinst/.

  • Use this install cd and install a base system on some computer.
  • Copy the network install cd to the filesystem where you'll be doing your work (e.g. /home/debian).

Getting Additional Packages, Option 1
  • Use Aptitude or ?AptGet to download the packages you want on the system and CD.

  • Install AptMove (e.g. apt-get install apt-move)

  • Modify apt-move.conf to use your pool directory as its local mirror (LOCALDIR)

  • AptMove your other packages to your pool directory (e.g. /home/debian/pool) by typing: apt-move update

Getting Additional Packages, Option 2
  • Use Aptitude or ?AptGet to download the packages you want on the system and cd.

  • Get AptMove (e.g. apt-get install apt-move)

  • Modify apt-move.conf to use a temporary directory as its local mirror (LOCALDIR)

  • AptMove your other packages to a temporary directory (e.g. /home/debian/tmp) by typing: apt-move update

  • Use a script such as the one at DebianCustomCD/MovePoolScript to copy packages from the temporary directory to your pool directory (e.g. /home/debian/pool). This is my preferred mode of operation because I have more control over what happens to what apt-move calls the 'mirror' (the pool directory), especially when building cd's for testing or unstable, which change quickly.

Optional Order

Instead of copying the network install cd first, copy your Apt cache to your desired pool directory first (as above), then use the above script to copy from the network install pool directory to your pool directory.

Notes on the use of AptMove

You will need to change apt-move.conf to point to your mirror. See AptMove for details (or man apt-move).

1. Getting Your Packages, Option 2

Pro: Works for all packages
Con: You have to figure out the dependencies yourself

  • Figure out what packages you'll need
  • Download them individually (if you make a list and use wget on the list, it wouldn't be as painful) into the pool directory in the filesystem where you'll be doing your work (e.g. /home/debian/pool).

  • Don't forget any dependencies (by hand! ugh!).

1. Getting Your Packages, Option 3

Pro: Works for all packages
Con: You have to learn Germinate and download a script

  • Use Germinate (available in Etch) to generate a list of packages and their dependencies based on an initial 'seed' (list of packages).

  • Use the perl script at DebianCustomCD/CustomDownload

  • For more information on generating the list of packages using germinate look at the Germinate page in this wiki.

2. Get DebianInstaller Binaries

  • The DebianInstaller binaries consist of files in and directory called installer-i386 and special packages in the Debian archive known as udebs (because they end with .udeb, as in micro-deb, unlike regular packages which end in .deb)

Make sure you get the udebs that correspond with the version of the DebianInstaller you downloaded to/from the installer-i386 directory. Using the Germinate method above and immediately downloading installer-i386 is one method while using a stable distribution and copying the udebs from the install cd, and downloading the appropriate installer-i386 is another. There are others.

DebianInstaller, Option 1
  1. Download installer-i386 from a Debian mirror (e.g. ftp://ftp.debian.org/debian/dists/sarge/main/current)

  2. You should have the correct udebs in your tree if you have downloaded the installer-i386 from the same distribution as your network install cd, or you downloaded installer-i386 from the same distribution (and immediately before or after) downloading the

    packages (including udebs) using Germinate

DebianInstaller, Option 2

The really isn't recommended but may be necessary in some cases

  1. Build DebianInstaller (which also downloads udebs). See DebianInstaller/Build.

  2. Copy udebs to your pool directory from debian-installer/installer/build/apt.udeb, using something like the

    script at DebianCustomCD/MoveInstallerUdebs

3. Make Mirror Recognizable to Apt

Download files need by apt-ftparchive
  1. Download /debian/indices/overrides.<dists>.*.gz for your distro (e.g. for sarge, /debian/indices/overrides.sarge.*.gz) into the directory indices which is in the same root directory as your pool (mirror) directory (e.g. /debian/pool, so /debian/indices).

  2. Gunzip the overrides, keeping the compressed files.

4. Generate Package lists and Release files for your 'distribution'

  • generate DebianInstaller packages files:

    • DebianInstaller lives in <debian-dir>/dists/<dist>/main/debian-installer/binary-i386

    • so create the appropriate subdirectories (e.g. mkdir -p /debian/dists/sarge/main/debian-installer/binary-i386).

  • in a directory (e.g. custom-cd-scripts) for your scripts and config files for this create an apt.conf such as the one at DebianCustomCD/PoolAptConf

  • create a file named yourcdname-di.conf (or anything else, just substitute your filename as appropriate), such as the one at DebianCustomCD/PoolDebianInstallerPackagesGzConf, creating the directories described therein

  • ArchiveDir is the parent directory of your pool and dists subdirectories

  • OverrideDir is the directory which contains your overrides

  • CacheDir is your temporary (cache) directory.

  • Under TreeDefault, Directory indicates the location of your pool (archive) directory

  • The path in quotes after BinDirectory (and before the curly brace), is the location, relative to ArchiveDir of the binary packages (well actually the alphabetic directories, which have the package directories under them).

  • Under BinDirectory, Packages is the full pathname of the Packages (without .gz even if you are creating compressed files) file you are creating (in this case the debian-installer Packages.gz).

  • execute the command in the directory containing the pool and dists directories

        apt-ftparchive -c custom-cd-scripts/apt.conf generate custom-cd-scripts/customcd-di.conf
  • repeat for the binary-i386 directories (under main, contrib, non-free):

    • create a file named yourcdname.conf such as the one at DebianCustomCD/PoolPackagesGzConf

      • execute the command  apt-ftparchive -c apt.conf generate yourcdname.conf 

  • Generate Release file:

    • execute the following command in the directory containing the

      pool and dists directories: {{{ apt-ftparchive -c custom-cd-scripts/apt.conf release dists/sarge >dists/sarge/Release }}}

Create the actual CD set

Note that you must have a mirror of the debian archive which is usable by ?AptGet and which has the DebianInstaller binaries.

Create List Of Files To Include On CD

  • You can do this by hand, or if you just want to include the latest

    versions of everything in your mirror (pool) directory, you can use something like the script at DebianCustomCD/ListPackagesInMirror

  • Alternatively combine the approaches and remove packages you don't
    • want. Note that dependencies are resolved for any debs (but not udebs), so don't be afraid to removing the lib packages (that way only what you actually need, or manually want to include, are added to the cd), except for lib*-udeb* which should be left so the installer works correctly.

Install and Configure debian-cd

  • Download and install the debian-cd package (e.g. apt-get install debian-cd)

  • cd /usr/share/debian-cd and edit CONF.sh

  • Note that INSTALLER_CD is set to 1. This includes tasks/debian-installer+kernel, and some other 'magic'. Just make sure the list of packages you produced as instructed above has all the kernel and debian-installer packages, and that tasks/debian-installer+kernel doesn't list any outdated packages.
  • Also note that the directories must all be on the same filesystem (except those under /usr/share/debian-cd)

The Remainder of the debian-cd Procedure

This assumes you have both binaries and sources. If you want binary only read the README for debian-cd.

NOTE Frans Pop has developed a relatively easy to use wrapper script for use with debian-cd that works with the current version of debian-cd. It was the mybuild.sh script previously available in available from alioth and has been included in debian-cd itself (starting with version 3.0.5). This script has been further improved and is renamed to easy-build.sh. README.easy-build file explains how to use it.

WARNING The following is very out-of-date and will not work with recent versions of debian-cd (3.0.X onwards). I hope to find time to fix it, but can't promise anything... -- SteveMcIntyre

  • Start a new shell (e.g. bash)

  • Source CONF.sh, e.g. by typing:

        . CONF.sh
  • make distclean

  • make mirrorcheck-binary

  • make mirrorcheck-source

    • If there are any missing dependencies, download them into your pool directory, regenerate your packages file, and start the debian-cd part of this procedure over again.

  • make status

    • This should never fail. If it does you're best determining what went wrong, but if you insist you can try make correctstatus

  • make list TASK=tasks/customcd

  • make bootable

    • Makes the binary cd(s?) bootable.
  • make md5list

    • Create the md5 checksums so that the cd can be verified.
  • make images

    • Actually makes the cd
  • make imagesums

    • the md5 checksum for the actual cd images
  • Burn it/them.