ºìÁªLinuxÃÅ»§
Linux°ïÖú

¶¨ÖÆUbuntu°²×°CD

·¢²¼Ê±¼ä:2006-04-26 01:31:02À´Ô´:ºìÁª×÷Õß:Î÷Î÷
¶¨ÖÆUbuntu CDµÄ¹ý³Ì²¢²»¸´ÔÓ£¬µ«ÊÇËýÓÐһЩ·±ËöºÍ¹ý·ÖµÄ½²¾¿¡£ÎÒ¶ÔÕâ¹ý³ÌµÄËùÖª²¢²»ÍêÃÀ£¬Òò´Ë£¬Ï£ÍûÓÐÈË¿ÉÒÔ×÷Êʵ±Ð޸ġ£

°²×°CDÓÐÈý¸öÖ÷Òª²¿·Ö£º

Æô¶¯Òýµ¼Æ÷£º(ÈçISOLINUXÓÃÓÚamd64/i386,yabootÓÃÓÚpowerpc)¿ª»úʱÄÚºËÓ³ÏóµÄÑ¡ÔñÓëÅäÖÃ;

Debian°²×°³ÌÐò(d-i)£ºÆäʵ¾ÍÊÇÒ»¸öÌØÊâµÄ΢Ubuntuϵͳ;

DebianÈí¼þ¿â£º·ÅÔÚ"pool"ºÍ"dists"Ŀ¼,Ëü½«Õ¼¾Ý¹âÅ̵Ĵ󲿷ֿռ䡣

½¨Á¢Õâ¸öеÄCD¾Í°üº­ÁËÕâÈý²¿·ÖµÄÐ޸ġ£

ÓÃ"Presseed"ÎļþÐ޸ݲװÐÐΪ

µ±CDÆô¶¯Ê±£¬LinuxÄں˾ͱ»×°ÔØÇÒ¿ªÊ¼°²×°ÈÎÎñ¡£°²×°³ÌÐòµÄÐÐΪ¿ÉÒÔÓÃÒ»¸ö"preseed"ÎļþÀ´Ð޸ģ¬ÕâЩÎļþ¸øDebian°²×°³ÌÐò(d-i)»Ø´ðÈçºÎÅäÖÃÈí¼þ°ü»òÆäËüÏà¹ØµÄÎÊÌâ¡£Èç¹ûÄú×Ðϸ¿´ÄãµÄ°²×°CD£¬Äú»áÕÒµ½ÕâЩѡÏî(ÀýÈçserver,expert,oem)¶¼ÓжÔÓ¦µÄpreseedÎļþ¡£

ËùÒÔ£¬¼ÙÉèÄúÏëÔÚһȺµÄÏàͬÅäÖõçÄÔÉϰ²×°breezy£¬²¢ÇÒÄúÒѾ­ÖªµÀ°²×°Ê±±ØÎÊÎÊÌâµÄ´ð°¸(ÄúËùÔڵĹú¼ÒºÍÊ±Çø£¬ÄúÄãµÄ¼üÅ̲¼¾Ö£¬ÄúµÄÍøÂçÉèÖã¬ÄúÐèÒªÈçºÎ·ÖÇøµÈµÈ)¡£Äú¿ÉÒÔͨ¹ý"preseed"ÔÚÒ»¼òµ¥µÄÅäÖÃÎļþÀï»Ø´ðÕâЩÎÊÌâ.

¸Ä±äisolinux.cfgÈ·¶¨ÄúµÄpreseed

Ê×ÏÈ£¬Äú±ØÐë¸æËß"d-i"ÕÒµ½ÄúµÄpreseedÎļþµÄÕýȷλÖá£ÔÚ±ê×¼µÄ¹âÅÌÉÏÓиö/preseedĿ¼£»Äú¿ÉÒÔ°ÑÄúµÄÕâЩÎļþ·ÅÕâÀï¡£ÄúÒªÐÞ¸ÄÆô¶¯Òýµ¼Æ÷µÄÅäÖÃÎļþ/isolinux/isolinux.cfgÖеÄÏà¹ØÄں˲ÎÊý£¬À´¸æËß"d-i"ÕÒµ½Õâ¸öÎļþ¡£ÎÒµÄÎļþÀïÓÐÏÂÁÐÐУº

DEFAULT /install/vmlinuz

APPEND preseed/file=/cdrom/preseed/learnexchange.seed kbd-chooser/method=us debian-installer/locale=en_CA vga=normal initrd=/install/initrd.gz ramdisk_size=16384 root=/dev/rd/0 DEBCONF_PRIORITY=critical debconf/priority=critical rw --

"DEFAULT"ÊÇÖ¸ÎÒÔÚbootÌáʾ·ûÏÂÖ±½Ó°´»Ø³µ¼ü×°ÔØµÄÄںˡ£APPEND °üº­ÁËÒª´«¸øÄں˵IJÎÊý¡£preseed/file ÊÇÕâ¶ù×îÖØÒªµÄ²ÎÊý£»½Ó×ŵÄÄÇÁ½¸öÖ¸³öÎҵļüÅ̲¼¾ÖÓü°±¾µØÎª¼ÓÄôó£»DEBCONF_PRIORITY ÓÃÀ´È·¶¨ÎÒ²»Ïë¿´µ½²»±ØÒªµÄÅäÖÃÈí¼þ°üÌáÎÊ¡£

¸ù¾ÝÄãµÄÇé¿öСÐÄÐÞ¸ÄÕâÎļþ.

дpreseedÎļþ

ÕâÀïÓкܶàʵÀý£»¿´¿´Õâ¸öÔÚ°²×°ÅÌÀïµÄ--server.seed£º

# Don't install usplash.

d-i base-installer/kernel/linux/extra-packages-2.6 string

# Desktop system not installed; don't waste time and disk space copying it.

d-i archive-copier/desktop-task string ubuntu-standard

d-i archive-copier/ship-task string

# Only install the standard system and language packs in the second stage.

base-config base-config/package-selection string ~t^ubuntu-standard$

base-config base-config/language-pack-patterns string language-pack-$LL

# No language support packages.

base-config base-config/install-language-support boolean false

(Note that the version of this file on breezy CD images was buggy: it set base-config/package-selection to "~tubuntu-standard" rather than "~t^ubuntu-standard$". Use the new version in preference; the old one will break with Ubuntu 6.04.)

Ê×ÏÈ×¢Òâ¸ñʽ£¬ÓÐ 4 ¸ö²¿·Ö£º

È¡µÃ±äÁ¿µÄ³ÌÐòÃû³Æ

´ð°¸µÄ±äÁ¿Ãû

±äÁ¿ÀàÐÍ

±äÁ¿Öµ

Á½¸öҪעÒâµÄµØ·½£ºÏÖÔÚ£¬d-i ÆÚÍûÓо«È·µÄÀàÐͺÍÖµ£»ÔÚbreezyÕâ¸ö°æ±¾²»Ö§³ÖÓà \ À´´¦Àí¶àÐÐ(еİ汾֧³Ö)¡£

ÎÒ½¨ÒéÄú´ÓһЩÏÖÓÐµÄ preseed À´ÐÞ¸Ä--Õâ¶ùÓÐÒ»¸ö¿ÉÒÔÓÃµÄ µã»÷¡£ Èç¹ûÄúûÄÜÔÚÕâ¶ùÕÒµ½£¬ÄǾÍÊÔ×ÅÖ´ÐÐÕâЩÃüÁ

debconf-get-selections --installer > somefile.txt

debconf-get-selections >> somefile.txt

Õâ»áÊä³öÒ»¸öÄúÔÚ°²×°Ê±ºò×÷³öµÄÑ¡ÔñµÄÁÐ±í£»ÕâÎļþÏ൱µØ³¤£¬²¢ÇÒʵ¼ÊÉϲ»ÄÇôÊʺÏÓÃÔÚ°²×°ÅÌÀï¡£ÌØ±ðÊÇ£¬NOTE: debconf-get-selections »áÔÚÀàÐͺÍÖ»Ö®¼ä·Å 2 ¸ö¿Õ¸ñ¡£ÄúµÃÔÚ°ÑËý·ÅÔÚ°²×°ÅÌÉÏÒÔǰÐÞ¸ÄËûÃÇ¡£

Èç¹ûÄúÏëÈà d-i °²×°¶îÍâµÄÈí¼þ°ü£¬»òÕßÒ»¸ö×îСµÄϵͳ£¬ÄúÐèÒªÔÚpreseedÀïÐÞ¸Ä "base-config base-config/package-selection"¡£This should be set to an aptitude pattern; see the aptitude documentation for more information on these. ÀýÈ磬±ê×¼°²×°Ò»¸öSSH·þÎñ£¬ÓÃÕâÒ»ÐУº

base-config base-config/package-selection string ~t^ubuntu-standard$|~t^ubuntu-desktop$|~n^openssh-server$

To install support for additional languages, a different mechanism is available, namely to preseed the detailed locale question asked by the installer in expert mode. See the first column of /usr/share/i18n/SUPPORTED for the locale names you can use here. ÀýÈç, Ôö¼ÓÃϼÓÀ­ÓïºÍÌ©Ã×¶ûÓïµÄÖ§³Ö£¬ÓÃÕâÒ»ÐУº

d-i localechooser/supported-locales multiselect ba_IN, ta_IN

ÐÞ¸ÄpoolĿ¼£¬Ôö¼Ó»òɾ³ýÈí¼þ°ü

Ò²ÐíÖÆ¶¨Äú×Ô¼ºµÄ°²×°CDµÄÖ÷ÒªÔ­ÒòÊÇÏë¸Ä±äËù°²×°Èí¼þ°ü£»ÌرðÊÇÄúÏëÔö¼ÓһЩ°üµ½CDÀï¡£ÕâÓкü¸¸ö·½·¨À´×öµ½£¬²»ÐèÒªÍêÈ«µØÀí½â¡£×îÈÝÒ×µÄÊÂÇéÊǽ¨Á¢Ò»¸ö×îСµÄ²Ö¿â·ÅÄúÏëÒªÔö¼ÓµÄ°ü£¬ÔÙÔÚÖÆ×÷¹âÅ̾µÏñÎļþ֮ǰºÏ²¢µ½¹âÅÌÎļþÌåϵÀï¡£Õâ¶ù¼¬Êֵĵط½ÊÇ£ºÖÆ×÷ÈÃDebianÈí¼þ°ü¹ÜÀíϵͳ֪µÀÕâ¸ö²Ö¿âµÄÏà¹ØÎļþ£»Ð´Ò»¸ö¸ü¸ß°æ±¾µÄReleaseÎļþ£»²¢Ç©ÉÏ GPG ¡£ÏÂÃæÊÇÎÒËù×öµÄ¡£

. Ñ¡¶¨Ò»¸öÎļþĿ¼×÷ΪÄúµÄ¹¤×÷¿Õ¼ä£»ÔÚÕâ¸öĿ¼À

mkdir -p dists/breezy/extras/binary-i386 pool/extras/ isolinux preseed

°ÑÄúÐ޸ĹýµÄisolinux.cfg·ÅÔÚĿ¼isolinux/£¬°ÑÄúµÄpreseedÎļþ·ÅÔÚĿ¼preseedÀï¡£ Put your modified isolinux.cfg in isolinux/, and your preseed file in preseed/.

. °ÑÄúÐèÒªµÄËùÓжîÍâµÄ°ü·ÅÔÚĿ¼ pool/extras/ Àï¡£Äú»¹ÐèÒª°üÀ¨Ò»¸öа汾µÄ ubuntu-keyring °ü£¬ÎÒ½«ÂíÉϽâÊÍÒ»ÏÂ

. ´´½¨²¢±à¼­Îļþdists/breezy/extras/binary-i386/Release£¬Ð´ÈëÏÂÃæµÄÄÚÈÝ:

Archive: breezy

Version: 5.10

Component: extras

Origin: Ubuntu

Label: Ubuntu

Architecture: i386

. °ÑÄú×öµÄÐÞ¸ÄÕâÑùºÏ²¢µ½CDÀï:

¹ÒÔØÄúÏÂÔØµÄ¹Ù·½ISOÎļþ£ºmount /path/to/iso /some/mountpoint/ -o loop

b. °Ñ¹âÅÌÀïµÄÈ«²¿Îļþ¿½±´µ½Ä³¸öĿ¼(Äú»áÐèÒª1µ½2GµÄ¿Õ¼ä)£»ÎÒÓÃrsync£ºsudo rsync -azvb --delete --backup-dir=/yeowe/usr/cdbuilder/old/ $MOUNT $BUILD ( Õâ¶ùµÄ $MOUNT ÊǹÒÔØµã£¬$BUILD ÊǶîÍâµÄ°üµÄĿ¼)

c. ×îÖØÒªµÄµØ·½. ÎÒÃǽ«ÓÃapt-ftparchive¹¤¾ßÀ´²úÉúÈí¼þ°üÏà¹ØºÍ¸ü¸ß°æ±¾µÄReleaseÎļþ¡£ÎÒÃÇ»¹ÒªÓÃGPGÀ´Ç©Õâ¸öReleaseÎļþ¡£°²×°³ÌÐò»áÓðüubuntu-keyring µÄ¹«³×À´¼ì²âÇ©Ãû¡£µ«ÊÇÄúµÄÇ©Ãû²»Ò»Ñù¡£ËùÒÔÄúµÃ½¨Á¢Ò»¸öа汾µÄ ubuntu-keyring °ü¡£Õâ×öÆðÀ´ºÜÈÝÒ×£¬µ«ÊÇҪȷ±£ÕýÈ·ÎÞÎó¡£ÏÂÃæÊÇÖ´ÐеÄÃüÁ

apt-get source ubuntu-keyring

cd ubuntu-keyring--2005.01.11/keyring

gpg --import < ubuntu-archive-keyring.gpg

gpg --list-keys "Your Name"

gpg --export FBB75451 437D05B5 YOURKEYID > ubuntu-archive-keyring.gpg

cd ..

dpkg-buildpackage -rfakeroot -m"Your Name -k"Your Name "

cp ubuntu-keyring*deb $BUILD/pool/extras/

OK -- what we've done here is import the 2 Ubuntu keys into your main keyring, then exported them along with your own key into a replacement keyring. "YOURKEYID" should be replaced with the 8-digit hexadecimal code that gpg tells you when you do the --list-keys command above. And really, the best policy would be to do all that first, and copy a version into your $STAGE file structure so that you have it permanently available.

Note: If you do not have an existing gpg signing key, use the following code:

gpg --gen-key

Accept all defaults, select "No expiry", and enter an appropriate passphrase.

In order to use apt-ftparchive, we will need to provide it with some defaults. Create the files "apt-ftparchive-deb.conf, "apt-ftparchive-udeb.conf", and "apt-ftparchive-extras.conf" as follows (substitude $BUILD for the absolute path to your BUILD directory, and /path/to/indices to the location of the indices files, which you can download from http://archive.ubuntu.com/ubuntu/indices/ ):

apt-ftparchive-deb.conf:

Dir {

ArchiveDir "$BUILD";

};

TreeDefault {

Directory "pool/";

};

BinDirectory "pool/main" {

Packages "dists/breezy/main/binary-i386/Packages";

BinOverride "/path/to/indices/override.breezy.main";

ExtraOverride "path/to/indices/override.breezy.extra.main";

};

Default {

Packages {

Extensions ".deb";

Compress ". gzip";

};

};


Contents {

Compress "gzip";

};

apt-ftparchive-udeb.conf:

Dir {

ArchiveDir "$BUILD";

};

TreeDefault {

Directory "pool/";

};

BinDirectory "pool/main" {

Packages "dists/breezy/main/debian-installer/binary-i386/Packages";

BinOverride "/path/to/indices/override.breezy.main.debian-installer";

};

Default {

Packages {

Extensions ".udeb";

Compress ". gzip";

};

};

Contents {

Compress "gzip";

};

apt-ftparchive-extras.conf:

Dir {

ArchiveDir "$BUILD";

};

TreeDefault {

Directory "pool/";

};

BinDirectory "pool/extras" {

Packages "dists/breezy/extras/binary-i386/Packages";

};

Default {

Packages {

Extensions ".deb";

Compress ". gzip";

};

};

Contents {

Compress "gzip";

};

. ÏÖÔÚ¾ÍÓÃapt-ftparchiveÀ´´´½¨PackagesºÍReleaseÎļþ£º

cd $BUILD

sudo apt-ftparchive -c $APTCONF generate /path/to/apt-ftparchive-deb.conf

sudo apt-ftparchive -c $APTCONF generate /path/to/apt-ftparchive-udeb.conf

sudo apt-ftparchive -c $APTCONF generate /path/to/apt-ftparchive-extras.conf

$APTCONF is a file somewhere that looks about like this:

APT::FTPArchive::Release::Origin "Ubuntu";

APT::FTPArchive::Release::Label "Ubuntu";

APT::FTPArchive::Release::Suite "breezy";

APT::FTPArchive::Release::Version "5.10";

APT::FTPArchive::Release::Codename "breezy";

APT::FTPArchive::Release::Architectures "i386";

APT::FTPArchive::Release::Components "main restricted extras";

APT::FTPArchive::Release::Description "Ubuntu Breezy";

¸øReleaseÎļþÇ©gpg:

sudo gpg --default-key "MY GPG KEY ID" --output $BUILD/dists/breezy/Release.gpg -ba $BUILD/dists/breezy/Release

*. Regenerate the md5 checksums:

cd $BUILD

find . -type f -print0 | xargs -0 md5sum > md5sum.txt

. ÏÖÔÚ¿ÉÒÔÀ´Éú³É¹âÅ̾µÏñÎļþ£º

sudo mkisofs -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -hide-rr-moved -o $IMAGE -R $BUILD/

¡®$IMAGE¡¯±íʾÄúµÄ¹âÅ̾µÏñÎļþ.

. ×îºó£¬¿ÉÒÔÓÃcdrecord»òÆäËü¿Ì¼¹¤¾ßÀ´¿Ì¼ÄúµÄCDÁË£º

sudo nice -18 cdrecord dev=ATA:1,1,0 speed=12 --blank=fast -v -gracetime=2 -tao $IMAGE

that will burn the image on the second cd drive; if your cd-burner is the first or only cd-drive, change dev argument to ATA:1,0,0. I strongly recommend using rewritable media -- I've burned a LOT of coasters on this project.

ºÃÁË£¬¸ã¶¨£¡ Èç¹ûË­¸ÐÐËȤ£¬ÎÒдÁËÒ»¸öС½Å±¾(ºÜ¼òµ¥)À´×Ô¶¯Íê³ÉÕâ¸ö²½Öè¡£ÎÒÏëÎÒÕýºÃ¿ÉÒÔ·ÅÔÚÕâ¶ù

#!/bin/bash

# usage

# update-learningexchange.sh kubuntu|ubuntu|xubuntu

# a very primitive script with no structure of controls etc

# no default behaviour, etc etc

# all ofthis should be trivial to implement but my

# bash syntax sucks

# obvious thing to do would be to convert to python

# & add a simple gtk front end too

# but I'm rushed at the moment

# Notes;Bugs:

# REMEMBER: this absolutely will not work if you haven't built a new version of ubuntu-keyring

# package & included that in $STAGE/pool/extras/! You do that thusly:

# apt-get source ubuntu-keyring

# cd ubuntu-keyring-version-info/keyring

# gpg --import < ubuntu-server-keyring.gpg

# gpg --output=ubuntu-server-keyring.gpg --export "ubuntu" "Your Name"

# dpkg-buildpackage -rfakeroot -m"My Name "

# cp ../ubuntu-keyring*deb $BUILD/pool/extras/

# VARIABLES

# this script relies on the existence of several files and directories:

# Original = $ORIG: location of the "clean", unmodified CD .iso

# CD mount point = $MOUNT: mount point of clean CD

# Staging area = $STAGE: where you keep all your files

# this area should include main dirs isolinux/, pool/, and dists/ at a minimum

# as written the script assumes you have a directory pool/extras with your

# extra debs, and that dists/breezy/extras/binary-i386/Release exists (copy it over

# from dists/breezy/main/binary-i386, and replace "main" with "extras")

# There is no doubt a better way to do this but it involves work...

# Building Area = $BUILD: location where your changes are merged into the "clean" directory \

# structure.

# Image location = $IMAGE: name of the new .iso file you want to build

# apt.conf file = $APTCONF: location of the file used to feed instructions to apt-ftparchive

ORIG="/var/www/jigdo/$1-breezy-install-i386.iso"

STAGE="/home/matt/LearningExchangeCD/$1/"

MOUNT=/mnt/iso/

BUILD="/yeowe/usr/cdbuilder/$1"

IMAGE="/yeowe/usr/cdbuilder/$1-learningexchange.iso"

APTCONF=/home/matt/LearningExchangeCD/apt.conf

# sync with latest image

sudo umount $MOUNT

sudo mount $ORIG $MOUNT -o loop

# sudo rsync -azvb --delete --exclude="language-pack*" --backup-dir=/yeowe/usr/cdbuilder/old/ $MOUNT $BUILD

sudo rsync -azvb --delete $MOUNT $BUILD

# now get rid of the old ubuntu-keyring package

sudo rm -r $BUILD/pool/u/ubuntu-keyring/

# note I've excluded a few files, shouldn't matter much for you I reckon

sudo rsync -avzb --exclude='*~' --exclude='INSTRUCTIONS.txt' --backup-dir=/yeowe/usr/cdbuilder/old/ --exclude='example-preseed.txt' $STAGE $BUILD

# generate Packages, Release, Release.gpg

# first thing to realize is, that we only need to generate the Packages files,

# the top-level Release file, and top-level Release.gpg.

# everything else should be in your $STAGE file structure or usable unchanged

# in the original form

# remove Release file otherwise you'll have trouble writing to it.

sudo rm $BUILD/dists/breezy/Release*

# ubuntu-keyring must be included in main/, so main NEEDS to be rebuilt!

for component in main extras; do

sudo apt-ftparchive packages "$BUILD/pool/$component/" > "$BUILD/dists/breezy/$component/binary-i386/Packages"

gzip -c "$BUILD/dists/breezy/$component/binary-i386/Packages" | \

sudo tee "$BUILD/dists/breezy/$component/binary-i386/Packages.gz" > /dev/null

done

sudo apt-ftparchive -c $APTCONF release $BUILD/dists/breezy > $BUILD/dists/breezy/Release

# gpg options: -ba = armored, detached-sig

sudo gpg --output $BUILD/dists/breezy/Release.gpg -ba $BUILD/dists/breezy/Release

# build the actual image. Note the options to mkisofs, which make the image bootable

sudo chown -R root:root $BUILD/isolinux $BUILD/preseed

sudo mkisofs -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -hide-rr-moved -o $IMAGE -R $BUILD/

# burn the image to 2nd cd drive on most setups

sudo nice -18 cdrecord dev=ATA:1,1,0 speed=12 --blank=fast -v -gracetime=2 -tao $IMAGE

CategoryDocumentation CategoryCleanup
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 7 ÌõÆÀÂÛ

  1. goodwang ÓÚ 2010-08-06 12:23:20·¢±í:

    5:ty(

  2. shenhao0129 ÓÚ 2010-05-30 22:40:03·¢±í:

    ¹ûÈ»ÊǸ߼¶Íæ·¨£¬¹þ¹þ

  3. zguangyu0000 ÓÚ 2010-05-29 14:21:24·¢±í:

    ÓÐÒ»ÖÖubuntu¾µÏñÀïÊÇÒ»¸ö´óµÄѹËõÎļþ£¬ÐèÒª½âѹ£¬½âѹºóÈ´°ü²»ÉÏÁË¡­¡­

  4. lizhe20032004 ÓÚ 2010-05-29 11:48:19·¢±í:

    ²»¶®¡£¡£¡£¡£ºÇºÇÔÚѧ

  5. benhuan ÓÚ 2010-05-28 21:51:19·¢±í:

    ÇëÎÊÂ¥Ö÷±¾·½·¨Ö§³ÖUbuntu10.04Âð£¿

  6. cxjnet ÓÚ 2009-12-10 21:50:29·¢±í:

    ×ö¸ö±êÖ¾£¬·½±ã²éÓÃ

  7. pkncoin ÓÚ 2006-07-18 21:32:33·¢±í:

    ÊܽÌÁË