~-Translation(s): [[DebianCustomCD|English]] - [[ru/DebianCustomCD|Russian(Русский)]] ## Auto-converted by kwiki2moinmoin v2005-10-07 = Создание собственного Debian CD = == Легкая альтернатива == Существует альтернативный способ создания собственного дистрибутива посмотрите на [[Simple-CDD]]. Если вам достаточно этого, то нет необходимости выполнять остальные действия(кроме любопытства). ---- == Введение == В данной статье описано как создать зеркало, используя кеш пакетного мененджера apt. И как использовать это зеркало совместно со специальным скриптом для создания собственного дистрибутива. Данная статья написана для архитектуры i386, но это должно работать и на других архитектурах, если в действиях заменить i386 на amd64 или на другую необходимую вам архитектуру, то всё должно получиться. == Краткая информация, Использование Apt, Binary Only == '''Важно''' Использование полного зеркала, или в основном полного зеркала это лучшая практика. Используйте частичное зеркало, только в случае необходимости (например из-за размера диска) понимая, что это не поддерживается. === Создать зеркало из Debian архив для Apt === ==== Вариант 1: Использование debmirror ==== Frans Pop has created a wrapper script for this which is [[http://alioth.debian.org/~fjp/debmirror/|available from alioth]]. A README explains how to use it. This is the preferred approach. ==== Вариант 2: Создать частичное зеркало из Debian архива ==== * 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 в каталог по вашему выбору * Создать каталог {{{pool}}} в файловой системе, где вы будете производить сборку своего нового 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..}}} files from ''http:///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 {{{/dists//main/debian-installer/binary-i386}}}, therefore * создать соответствующие 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 }}} * повторить для 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. ---- == Подробные инструкции == '''Важно''' Использование полного зеркала, или в основном полного зеркала это лучшая практика. Используйте частичное зеркало, только в случае необходимости (например из-за размера диска) понимая, что это не поддерживается. === Preferred: Использование debmirror === Frans Pop has created a wrapper script for this which is [[http://alioth.debian.org/~fjp/debmirror/|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. === Дополнительно: Создание частичного зеркала архива Debian для Apt (опция) === ==== 1. Getting Your Packages, Вариант 1 ==== Pro: Будут автоматически разрешенные зависимости и загружены<
> Con: Только для пакетов, зависимости не установлены ===== Get Your Base System (Optional) ===== The following will get a you 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 you 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/. * Используйте этот установочный компакт-диск и установите базовую систему на компьютере. * Скопировать network install cd to the filesystem где вы будете делать вашу работу (например {{{/home/debian}}}). ===== Получение дополнительных пакетов, Вариант 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}}} ===== Получение дополнительных пакетов, Вариант 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) 1. 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]]. 1. 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..*.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}}}). 1. Gunzip the overrides, keeping the compressed files. ==== 4. Generate Package lists and Release files for your 'distribution' ==== * generate DebianInstaller packages files: * DebianInstaller lives in {{{/dists//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 [[http://alioth.debian.org/~fjp/debian-cd/|available from alioth]] and has been included in [[http://svn.debian.org/wsvn/debian-cd/trunk/|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. ## 3.0.5 is still not in unstable thus SVN site is referenced. '''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.