You are on page 1of 11

LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

Login to Edit

Ubuntu Documentation > Community Documentation > LiveCDCustomization

定制 Live CD
如何定制 Ubuntu Desktop CD 目录

1. 如何定制 Ubuntu Desktop CD


你或许基于以下原因定制 Ubuntu Desktop (live) CD: 2. 系统需求
3. 定制过程
发布自己的 Linux / Ubuntu 系统 1. 释放出光盘的内容
预装特定的程序 2. 释放桌面系统
本地化语言支持 3. 准备并虚拟根目录
移出软件安装包 4. 定制
添加软件安装包 1. Apt-get
更新软件安装包 2. 定制 GNOME的桌面背景
改变系统默认设置 (主题、图标、桌面、面板、浏览器主页等 3. 更改 gconf (字体、面板等等)
等) 1. 更改几个gconf项目
4. 更改gfxboot的默认语言
5. 个性化定制
6. 默认杂项
本向导针对桌面版/Live CD; 这儿有指向 定制文字安装盘或服 5. 高级定制
务器安装光盘的链接. 1. Live CD 内核
2. 启动设置
系统需求 3. 重建 initrd
6. 清理
7. 整合 CD 光盘
至少3-5 GB的空闲磁盘空间 8. 测试 CD
至少512MB内存和1GB交换分区(推荐) 1. 疑难解答
squashfs-tools 9. 烧录 CD 镜像
10. 有用的附加镜像
genisoimage, 其提供 mkisofs工具
4. 评论
一个支持 squashfs 的Ubuntu内核(Ubuntu6.06以及更高版
本)
QEMU/KVM, VirtualBox 或VMware用于测试(可选)

定制过程
首先, 请确认你安装了必要的工具

加载 squashfs 模块

你需要从 http://releases.ubuntu.com/下载一张官方的图形安装光盘

注: 以ubuntu-8.10-desktop-i386.iso桌面CD为例

把它移动或者复制到一个空的目录

释放出光盘的内容
挂载桌面系统 .iso

第1页 共11页 7/7/2009 12:17 AM


LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

把 .iso 的内容释放到 'extract-cd' 目录

释放桌面系统
挂载 squashfs 文件系统

把 squashfs 内容释放到 'edit' 目录

准备并虚拟根目录
如果你需要在虚拟根系统内使用网络连接

根据你的配置, 你也许 需要复制 hosts 文件

(这些将挂载你主机系统的重要目录-如果您之后决定删除 edit/ 目录, 请务必在删除之前先卸载他们, 否则你的主机系统


直到下次重新启动之前将无法使用)

为了避免区域问题以及导入 GPG keys

定制

Apt-get

根据大小查看已安装的软件包

当移去软件包时记得使用purge参数

定制 GNOME的桌面背景

通常背影文件位于/usr/share/backgrounds. 复制你的PNG文件到那里, 调整所有者和文件存取, 并编辑下面的文档:

1. /usr/share/gnome-background-properties/ubuntu-wallpapers.xml 和
2. /usr/share/gconf/defaults/16_ubuntu-artwork 或者在相同目录中的其他文件. 更改字符串 /usr/share/backgrounds
/warty-final-ubuntu.png 指向你的文件

最后更改或添加属性到其它配置文件, 如: /var/lib/gconf/debian.defaults/%gconf-tree.xml 或者 /etc/gconf


/gconf.xml.defaults/%gconf-tree.xml).

第2页 共11页 7/7/2009 12:17 AM


LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

历史上: 更多小巧的配置...

更改 gconf (字体、面板等等)

对 gconf 的任何设置变更都必须在 /etc/gconf/gconf.xml.defaults/%gconf-tree.xml文件中添加相应的值. 在此文件中添加


一个值将改变 GNOME 或者其他程序的默认设置, 所以你可以更改字体, 背影, 主题, 指针等等.

可以使用gedit 或者其他文本编辑器替代, 你也可是使用 gconftool-2, 在 chroot 环境下, 执行如下的命令行:

在这儿 string, yourkey 和 yourvalue 分别是你想更改的类型、主键和值...

更改几个gconf项目

通过编辑gconf来分别设置每个值需要太多的时间. 有一个更好的办法:

为按照你的意愿来测试用户和调整设置. 执行

然后, 在chroot环境中, 执行

通过这个方法你可以导入整个分支, 例如 /apps/panel - Gnome面板的所有设置.

更改gfxboot的默认语言

这部分定制必须在chroot环境之外进行.

更改 "fi" 为你的本地语言. 注意这个修改不会影响 F2 菜单中的选项. 要了解更多关于 gfxboot 的定制内容请访问 Ubuntu


Customization Kit.

变更 gfxboot 默认语言而不重建软件包的另一种方法是在isolinux目录中创建一个名称为 lang 的文件来加载你的本


地语言名称.

个性化定制

经过个性化定制后确保没有任何一个用户的 UID >= 1000. 否则您的镜像将因为没有有效的初始用户而无法启动 (见


/usr/lib/user-setup/functions.sh and /usr/lib/user-setup/user-setup-apply). 在 chroot 环境中:

如果你受到限制, 尝试更改 uid:

默认杂项

你或许希望通过编辑 /etc/default 中的文件来改变系统的默认启动行为. 你也可以编辑 /etc/profile, /etc/bash.bashrc, 和


/etc/bash_completion 来改变系统所有用户的登录设置. 你不能直接编辑 live cd 的默认用户 (如, casper, ubuntu, or user) 因
为该帐户是在系统启动时创建的. 你可以直接编辑根用户的默认文件 (/root 在 chroot 环境中).

如果你想改变live cd 的默认时区, 执行:

第3页 共11页 7/7/2009 12:17 AM


LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

如果你希望添加一个新位置并将其置为默认位置, 更新 /etc/default/locale. 你可能需要编辑位置:

这些更改必须以root身份在chroot环境执行.

高级定制

Live CD 内核

果你想进一步定制启动过程, 您可以变更livecd的内核, 通过复制vmlinuz和的initrd来取代在extract-cd/casper找到的相同


内容.

比如

启动设置

你必须编辑/usr/share/initramfs-tools/scripts/casper-bottom/* 中的文件比如你可以改变主机名称或者live cd用户.

比如

编辑用户名和主机名

甚至是live cd的用户密码.

另外. 为了获得一个加密的密码, 你必须使用 mkpasswd 程序查询软件包的运作方式!

重建 initrd

在你修改了内核后, init脚本或许增加了新的内核模块, 您需要重建initrd.gz文件并替代 casper 文件夹的内容.

(替换CD启动时使用的内核版本 - 这个可以再 edit/lib/modules 中找到)

退出的chroot环境和移动此文件到 extract-cd/casper:

清理
请务必删除一些不再需要的临时文件, 单张 CD 的空间有限. 一个典型的例子是下载的包文件, 它可以使用如下命令清
理:

或者删除临时文件

或名服务器的设置

第4页 共11页 7/7/2009 12:17 AM


LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

从 chroot 环境内.

现在卸载(unmount) 特定的文件系统并退出

注意: 如果 "umount /proc" 命令失败那么尝试 "umount -lf /proc"

整合 CD 光盘
重新生成manifest文件

压缩文件系统

注:-nolzma 选项只适用于Hardy.

在 extract-cd/README.diskdefines 中添加镜像的名称

删除旧的 md5sum.txt文件并计算新的 md5 码

(检查文件 "md5sum.txt" 和 "./isolinux/boot.cat" 有没有出现在 md5sum.txt文件中. 如果有, 删除其所在的行)

检查 Iso

测试 CD
使用qemu模拟器测试

或者你有kvm硬件加速

你也可以使用 virtualbox-ose, 这个在ubuntu软件仓库中有效并且免费提供.

疑难解答

在改变ivecd系统内核后虚拟运行中会出现一些疑难问题. 如果你遇到了, 那么在启动界面出现时按一下F6键. 引动光标


到splash quite 和 -- 之间并键入: all_generic_ide

第5页 共11页 7/7/2009 12:17 AM


LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

烧录 CD 镜像
很简单! 这样做

有用的附加镜像
安装 Ubuntu 到 USB 盘

从硬盘加载安装镜像文件

评论
如果您有任何意见或问题, 请随时将其添加在这里.

我已经创建了一个小型的定制实例 (名字叫火鸟 Live CD) 安装了一个 firebird2.1-superand flamerobin 软件包 (this apply
to ubuntu Hardy Heron also it was tested with xubuntu 8.04) http://flamerobin.blogspot.com/2008/08/creating-
flamerobinfirebird-livecd-with.html

Warning: qemu did not work for me as given in the guide above. Even the normal 8.04 live cd would not boot correctly. Every
time, I would get thrown into the ash shell (busybox, initramfs) and while there, a "cat /casper.log" would reveal that it was
"Unable to find a medium containing a live filesystem". Just use virtualbox-ose. It actually works with virtualbox. However, after
using apt-get to install virtualbox-ose, I had to run "sudo depmod" again in order for the vboxdrv module to be found by
modprobe. Hope that helps!

-rocketman768

Warning: Squashfs is currently in development and is thus not finalized as a format. This means you cannot assume a
filesystem.squashfs created using the Ubuntu 8.10 version of makesquashfs will be compatible with the squashfs drive an older
live CD. I was customizing an Ubuntu 7.10 LiveCD and when testing it always booted it an (initramfs) prompt--the squashfs was
not getting mounted as /. I had to build from within an Ubuntu 7.10 chroot to get it to work.

--Bob/Paul

I have created an small Customization Example (named Firebird Live CD) by adding an firebird-super-server and flamerobin
packages (this apply to ubuntu dapper drake) http://flamerobin.blogspot.com/2006/05/creating-flamerobinfirebird-live-cd.html I
created an updated guide with Ubuntu Festy Fawn also with an iso download for the Firebird/Flamerobin live cd
http://flamerobin.blogspot.com/2007/09/creating-flamerobinfirebird-livecd-with.html

I have created tool for automatic remastering of live CD images. See http://uck.sourceforge.net/ .

Features:

GUI for simple creation of localized CDs (including changing gfxboot and installing language packs)
Script for customization of ISO, SquashFS and initrd on live CD.

http://www.atworkonline.it/~bibe/ubuntu/custom-livecd.htm seems to have some nice info. no license that I can see so we would
need to ask permission from the author to us its material.

If you want to make the CD boot faster, you might try sorting the files so that they are in the CD in the order that they are
accessed: http://lichota.net/%7Ekrzysiek/projects/kubuntu/dapper-livecd-optimization/

Great How To. I am having one issue however. I would like to use custom xorg.conf and sources.list files. Any tips on doing
this? Thanks.

Simply, copy the files to edit/etc/ in the same way (and at the same time) that you copy in the resolv.conf and hosts files.
I have found that copying xorg.conf doesn't work, as the boot-time scripts overwrite it. Besides, you can't guarantee that a
particular xorg.conf will run on all hosts. I'm currently trying to get the binary NVIDIA drivers to work out of the box if an

第6页 共11页 7/7/2009 12:17 AM


LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

NVIDIA card is present. If I figure out how to fix the xorg.conf, I'll post it here. --JeremyVisser

I've managed to get Synaptic running from within the chroot environment, but it does hang when I try to apply packages. What
you do is run "Xnest -ac :1" to get an Xnest server to run on display :1 without access control so anyone can connect to it. Then,
in the chroot environment, run "export DISPLAY=:1" to get programs to use the display. Then, type "metacity &" to be able to
move windows. Finally, run "synaptic".

It works fine until you try to apply packages, where it hangs for me. --JeremyVisser

Shouldn't the mkinitramfs command use the casper scripts, like "mkinitramfs -o initrd.gz 2.6.15-23-386 -d /usr/share/initramfs-
tools"?

There are tricks on how you can get to feel the GNOME system in your chroot environment.

1. Copy your xorg.conf in the chrooted "etc/X11/" directory.

2. Create generic devices on your chroot system using MAKEDEV

3. Start X or restart gdm

Supposed you want to make modifications on the Desktop, that will be used by all the new users, just change your $HOME to
/etc/skel/ and start gdm or X.

If you want to load all the other stuff GNOME needs (i.e, dbus, avahi, network-manager), just boot as (single-user mode), and
start dbus in your chrooted environment.

An example of the whole procedure. (under single-user mode)

--- joelbryan

Hello,

I am about to build a new Livecd and have a question: When I change the username, hostname and the user's password the user
login automatically during booting the livesystem. But this is not desired. Is it correct, that I have to enter a password under a
Desktop LiveCD when I delet the encrypted password in /usr/share/initramfs-tools/scripts/casper-bottom/10adduser ?

Thanks

Changing username and password will not change login behaviour, because this is done in /usr/share/initramfs-tools/scripts
/casper-bottom/15autologin

--- Alexander Hosfeld

第7页 共11页 7/7/2009 12:17 AM


LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

Having trouble starting a MySQL server from within the chroot jail. Any suggestions?

- Dave

Hey,

I am trying to make a customized live cd of Kubuntu 6.06 that will be completly preconfigured, so that when the user clicks on
the install icon on KDE the installer should do everything by itself, meaning that the installer should not ask any questions to the
user.

To do this I am trying to write a preseed file to tell the installer the information that it needs.

The problem is that even with this preseed file I could only tell the installer what is the username that it should use, the rest of
the information is simply ignored by the installer.

I must be doing something wrong and would appreciate any and all help given me.

Thanks, Komyg

PS: Should I post my preseed file here?

If the livecd is not going to be used for the purposes of installing what files can be removed? Can the "pool" files containing the
.debs be removed too?

- Mike

If I want to put in my LiveCD applications that aren't in the sources.list (like ooffice 2.2 or perl audio converter), what cain I do?

- Isoldanne

When you're in the chroot you can install applications just like you would on a live system. If you install from source you can
feel free to delete the source tarbal and make folders after you do 'make install'.

- Bob/Paul

To get desired /etc/X11/xorg.conf one can modify the /usr/bin/dexconf. This script generates xorg.conf
automatically in liveCD session according to the booted machine.

For example:

-- yotam

I cant do chroot. When i run it a get this error

chroot: cannot run command `/bin/bash': No such file or directory

Please help me out

I had the same problem because the filesystem that I was working on was FAT32 instead of EXT2 or EXT3. Because of
that, /bin/bash was not an executable I guess. If that is your case also, then please try again on a partition that is EXT2 or
EXT3 (the Linux type of partition). Good luck,
--vvim

Hi, I've created a simple script to ease remastering the Kubuntu Live CD. It uses aufs to avoid copying all the files back and
forth.

Maybe it will be usefull to others too. The script must be run as root.

第8页 共11页 7/7/2009 12:17 AM


LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

--- Petr Pudlak

I need to know how to configure the live cd so that it does not use SWAP!

Please help me!

-- iceman

第9页 共11页 7/7/2009 12:17 AM


LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

Hi, I've been experiencing problems with aptitude and I'm pretty sure its because I'm doing all this stuff on NTFS partition
(according to this thread http://ubuntuforums.org/showthread.php?t=521905). But I have no other choice,coz' I've got less then
1,7GB on my ext3 partition. Any suggestion ? THX

Error messages I've been getting, when trying to install or update aptitude:

"E: Couldn't make mmap of 25165824 bytes - mmap (19 No such device) W: Unable to munmap E: The package lists or status
file could not be parsed or opened."

-heethen (heethen at centrum dot cz)

I would suggest creating an ext3 filesystem within your NTFS partition. To create the file, type

dd if=/dev/zero of=/mnt/hda1/workspace.img bs=1024 count=$((1024*1024*15))

Where I assumed your NTFS partition was on hda1, and you wanted to call the new filesystem workspace.img (it's really just a
file within NTFS), and that you wanted 15Gb of room to work. (You don't need that much, but with 15Gb you should have
plenty of room.) Then you format the new filesystem with the command

sudo /sbin/mkfs.ext3 /mnt/hda1/workspace.img

then create a mountpoint

sudo mkdir /mnt/workspace

then mount the new filesystem

sudo mount -o loop /mnt/hda1/workspace.img /mnt/workspace

You can then use as much space on the NTFS partition as you want, and have all the benefits of ext3 (like getting the *** thing
to work). --Tom

Editing gconf by setting each value separately takes too much time. There is a better way:

Make a test user and adjust the settings as you wish. Run

and then, in the chroot environment, run

This way you can import the whole branch, e.g. /apps/panel - all settings for Gnome's panels.

---Jacob Popov ubuntu-8.10-desktop-i386.iso

Is there no way to copy the user's gconf-values to the default gconf-values in the chrooted environment? This would be a lot
easier than writing commands.

It took me a long time to find the details for configuring a static IP on the live CD without doing it in the root file system. This
enables you to create a few boot options with different static details and a DHCP on but all from the same rootfs.

There is a casper parameter which is in the form:

ip=IFACE,ADDRESS,NETMASK,GATEWAY[:IFACE,ADDRESS,NETMASK,GATEWAY]*

--silid

http://ubuntuforums.org/showthread.php?t=839670

I think I have discovered how to do this:

第10页 共11页 7/7/2009 12:17 AM


LiveCDCustomization - Community Ubuntu Documentation file:///H:/th/Ubuntu%20Live%20CD%20Customization/LiveCDCustomiza...

1) Edit accordingly /usr/share/initramfs-tools/scripts/casper-bottom/23networking

2) Run update-initramfs -u -k $version

- Robert

In order to get the livecd to boot from a static address found in the /etc/network/interfaces file.

I edit the /etc/network/interfaces file and add a static address for the interface eth0.

edit somepath/isolinux/text.cfg add ip=frommedia after splash

This was a little hard to find. Thanks Robert Nicholas A. Schembi Pittsburgh PA USA

I've tried installing adobe flash player but while it installs fine on chroot, and then shows as installed when booting from CD.
Firefox thinks it is not installed and I need to install it manually. Anybody come upon a similar problem

LiveCDCustomization (在 2009-05-04 03:07:32 由 https://login.launchpad.net/+id/hTCQFPG @


cdm-75-109-250-150.asbnva.dh.suddenlink.net[75.109.250.150]:zerothis 编辑)

Page History

第11页 共11页 7/7/2009 12:17 AM

You might also like