老旧文章/UbuntuHelp:LiveCDCustomization/zh:修订间差异
无编辑摘要 |
Luojie-dune(留言 | 贡献) |
||
(未显示2个用户的34个中间版本) | |||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/LiveCDCustomization}} | |||
{{Languages|UbuntuHelp:LiveCDCustomization}} | |||
---- | ---- | ||
== 如何定制Ubuntu图形安装光盘 == | |||
你或许基于以下原因定制UBUNTU桌面(LIVE)版: | 你或许基于以下原因定制UBUNTU桌面(LIVE)版: | ||
第36行: | 第17行: | ||
本向导针对桌面版/LIVE CD,[https://help.ubuntu.com/community/InstallCDCustomization 定制文字安装光盘和服务器安装光盘]请参考其他页面。 | 本向导针对桌面版/LIVE CD,[https://help.ubuntu.com/community/InstallCDCustomization 定制文字安装光盘和服务器安装光盘]请参考其他页面。 | ||
== 系统需求 == | |||
* 至少3-5 GB的空闲磁盘空间 | * 至少3-5 GB的空闲磁盘空间 | ||
* 至少512MB内存和1GB交换分区(推荐) | * 至少512MB内存和1GB交换分区(推荐) | ||
* squashfs-tools | * squashfs-tools 用以压缩文件系统<br> | ||
* mkisofs | * mkisofs | ||
* 一个支持squashfs的Ubuntu内核(Ubuntu6.06以及更高版本) | * 一个支持squashfs的Ubuntu内核(Ubuntu6.06以及更高版本) | ||
* QEMU、VirtualBox或VMware用于测试(可选)<br> | * QEMU、VirtualBox或VMware用于测试(可选)<br> | ||
== 过程 == | |||
首先,请确认你安装了必要的工具: | 首先,请确认你安装了必要的工具: | ||
<pre> | <pre>sudo apt-get install squashfs-tools mkisofs qemu | ||
</pre> | </pre> | ||
加载 squashfs 模块 | 加载 squashfs 模块 | ||
<pre> | <pre>sudo modprobe squashfs | ||
</pre> | </pre> | ||
你需要从 http://releases.ubuntu.com/ 下载一张官方的图形安装光盘 | 你需要从 http://releases.ubuntu.com/ 下载一张官方的图形安装光盘 | ||
第58行: | 第39行: | ||
把它移动或者复制到一个空的目录: | 把它移动或者复制到一个空的目录: | ||
<pre> | <pre>mkdir ~/live | ||
mv ubuntu-7.10-desktop-i386.iso ~/live | |||
cd ~/live | |||
</pre> | </pre> | ||
=== 释放出光盘的内容 === | |||
挂载桌面系统 .iso | 挂载桌面系统 .iso | ||
<pre> | <pre>mkdir mnt | ||
sudo mount -o loop ubuntu-7.10-desktop-i386.iso mnt | |||
</pre> | </pre> | ||
把 .iso 的内容释放到 'extract-cd' 目录 | 把 .iso 的内容释放到 'extract-cd' 目录 | ||
<pre> | <pre>mkdir extract-cd | ||
rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd | |||
</pre> | </pre> | ||
=== 释放桌面系统 === | |||
加载 squashfs 文件系统 | 加载 squashfs 文件系统 | ||
<pre> | <pre>mkdir squashfs | ||
sudo mount -t squashfs -o loop mnt/casper/filesystem.squashfs squashfs | |||
</pre> | </pre> | ||
把 squashfs 内容释放到 'edit' 目录 | 把 squashfs 内容释放到 'edit' 目录 | ||
<pre> | <pre>mkdir edit | ||
sudo cp -a squashfs/* edit/ | |||
</pre> | </pre> | ||
=== | === 准备以及虚拟根目录 === | ||
<pre> | |||
如果你需要在虚拟根系统内使用网络连接 | |||
<pre>sudo cp /etc/resolv.conf edit/etc/ | |||
</pre> | </pre> | ||
根据你的配置,你也许需要复制'''hosts'''文件 | |||
<pre>sudo cp /etc/hosts edit/etc/ | |||
</pre> <pre>sudo chroot edit | |||
mount -t proc none /proc | |||
mount -t sysfs none /sys | |||
mount -t devpts none /dev/pts | |||
</pre> | |||
为了避免区域问题以及导入GPS key | |||
<pre>export HOME=/root | |||
export LC_ALL=C | |||
</pre> | |||
=== 定制 === | |||
==== 预装软件 ==== | |||
==== | 根据大小查看被安装的软件包 | ||
<pre>dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less | |||
</pre> | |||
移去软件包使用purge参数 | |||
<pre>apt-get remove --purge package name | |||
</pre> | |||
==== 设置GNOME的桌面 ==== | |||
通常桌面文件位于'''/usr/share/backgrounds'''。复制你的PNG文件到那里并编辑下面的文档: | |||
1. '''/usr/share/gnome-background-properties/ubuntu-wallpapers.xml''' | |||
2. '''/etc/gconf/gconf.xml.defaults/%gconf-tree.xml''' | |||
更改字符串 '''/usr/share/backgrounds/warty-final-ubuntu.png''' 指向你的文件。 | |||
==== 更改 gconf (字体、面板等等) ==== | |||
<pre> | |||
对 gconf 的任何设置变更都必须在 '''/etc/gconf/gconf.xml.defaults/%gconf-tree.xml'''文件中添加相应的值。 | |||
在此文件中的操作可以变更 GNOME 或者其他程序的默认设置,因此你能修改字体,桌面,主题,指针等。 | |||
可替代为 '''gedit''' 或者其他文本编辑器,你能在 chroot 环境下,使用 '''gconftool-2'''运行以下命令: | |||
<pre>gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set yourkey "yourvalue" | |||
</pre> | </pre> | ||
在这里 ''string'', ''yourkey'' 和 ''yourvalue'' 是你需要修改的部分。 | |||
==== 更改gfxboot的默认语言 ==== | |||
这部分定制需要在chroot进行。 | |||
<pre> | <pre>sudo -s | ||
apt-get install dpkg-dev | |||
apt-get source gfxboot-theme-ubuntu gfxboot | |||
cd gfxboot-theme-ubuntu*/ | |||
make DEFAULT_LANG=fi | |||
sudo cp -af boot/* ../extract-cd/isolinux/ | |||
exit | |||
</pre> | </pre> | ||
更改 "fi"为你的本地语言。注意这个修改不会影响 F2 菜单中选项。要了解更多关于 gfxboot 定制的内容请访问 [http://uck.sourceforge.net/ Ubuntu Customization Kit]。 | |||
* 变更 gfxboot 默认语言的另一种方法是 A other way to change the default language of gfxboot without rebuild the packages is to create a file name '''lang''' in the isolinux directory containing your locale's name. | |||
====Customization limits==== | |||
After customization make sure that there are no users with an UID >= 1000. Otherwise your image won't boot because no initial user is available (see /usr/lib/user-setup/functions.sh and /usr/lib/user-setup/user-setup-apply). While in chroot: | |||
<pre> | |||
grep '^[^:]*:[^:]*:[1-9][0-9][0-9][0-9]:' /etc/passwd | |||
grep '^[^:]*:[^:]*:[12][0-9][0-9][0-9][0-9]:' /etc/passwd | |||
</pre> | |||
If you get any hits, try changing the uid: | |||
<pre> | |||
usermod -u 500 $hit | |||
</pre> | |||
=== 高级定制 === | |||
====图形安装光盘内核==== | |||
If you want to customize further the boot process, you can change the livecd kernel, by copying the vmlinuz and initrd you want in place of the ones you find in extract-cd/casper (don't forget to apt-get the right kernel, the one that matches the livecd one, once chrooted into edit). | |||
i.e. | |||
<pre> | |||
sudo cp /boot/vmlinuz-2.6.15-26-k7 extract-cd/casper/vmlinuz | |||
sudo cp /boot/initrd.img-2.6.15-26-k7 extract-cd/casper/initrd.gz | |||
</pre> | |||
====启动设置==== | |||
You have to edit the files in edit/usr/share/initramfs-tools/scripts/casper-bottom/* | |||
For example you can change the hostname or the livecd user. | |||
i.e. | |||
<pre> | |||
sudo nano edit/usr/share/initramfs-tools/scripts/casper | |||
</pre> | |||
and edit the username or hostname | |||
<pre> | |||
sudo nano edit/usr/share/initramfs-tools/scripts/casper-bottom/10adduser | |||
</pre> | |||
to edit even the livecd user's password. | |||
P.S. in order to obtain an encrypted password, you have to use the mkpasswd program that's shipped with whois package! | |||
====重建initrd==== | |||
After you've modified the kernel, init scripts or added new kernel modules, you need to rebuild the initrd.gz file and substitute it into the casper directory. | |||
<pre> | |||
sudo chroot edit | |||
mkinitramfs -o /initrd.gz 2.6.15-26-k7 | |||
</pre> | |||
(replace the kernel version with the one that the CD will boot with - this can be found in edit/lib/modules) | |||
Exit from the chroot jail and move this file to extract-cd/casper: | |||
<pre> | |||
exit | |||
mv edit/initrd.gz extract-cd/casper/ | |||
</pre> | |||
=== 清理 === | |||
Be sure to remove any temporary files which are no longer needed, as space on a CD is limited. A classic example is downloaded package files, which can be cleaned out using: | |||
<pre> | |||
apt-get clean | |||
</pre> | |||
Or delete temporary files | |||
<pre> | |||
rm -rf /tmp/* | |||
</pre> | |||
Or nameserver settings | |||
<pre> | |||
rm /etc/resolv.conf | |||
</pre> | |||
now umount (unmount) special filesystems and exit chroot | |||
<pre> | |||
umount /proc | |||
umount /sys | |||
umount /dev/pts | |||
exit | |||
</pre> | |||
===整合光盘=== | |||
Regenerate manifest | |||
<pre> | |||
chmod +w extract-cd/casper/filesystem.manifest | |||
sudo chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest | |||
sudo cp extract-cd/casper/filesystem.manifest extract-cd/casper/filesystem.manifest-desktop | |||
sudo sed -ie '/ubiquity/d' extract-cd/casper/filesystem.manifest-desktop | |||
</pre> | |||
Compress filesystem | Compress filesystem | ||
<pre> | |||
sudo rm extract-cd/casper/filesystem.squashfs | |||
sudo mksquashfs edit extract-cd/casper/filesystem.squashfs | |||
</pre> | |||
Set an image name in extract-cd/README.diskdefines | Set an image name in extract-cd/README.diskdefines | ||
<pre> | |||
sudo vim extract-cd/README.diskdefines | |||
</pre> | |||
Remove old md5sum.txt and calculate new md5 sums | |||
<pre> | |||
</pre> | <pre> | ||
sudo -s | |||
rm extract-cd/md5sum.txt | |||
(cd extract-cd && find . -type f -print0 | xargs -0 md5sum > md5sum.txt) | |||
exit | |||
</pre> | |||
Create Iso | Create Iso | ||
<pre> | |||
cd extract-cd | |||
sudo mkisofs -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-6.06.2-desktop-i386-custom.iso . | |||
</pre> | |||
=== 测试光盘 === | |||
使用QEMU虚拟机测试 | |||
<pre> | |||
<pre>qemu -cdrom ubuntu-7.10-desktop-i386-custom.iso -boot d | |||
</pre> | </pre> | ||
=== | 你也可以使用 Virtualbox-ose 进行测试,在 Ubuntu 的软件库中可以找到它。 | ||
=== 烧录光盘 === | |||
简单!如下: | |||
<pre>cdrecord dev=/dev/cdrom ubuntu-7.10-desktop-i386-custom.iso</pre> | |||
<pre> | |||
</pre> | |||
== | == 评论 == | ||
If you have any comments or questions, please feel free to add them here. | If you have any comments or questions, please feel free to add them here. | ||
第149行: | 第271行: | ||
I have created an small Customization Example (named Firebird Live CD) by adding an firebird-super-server and flamerobin packages | I have created an small Customization Example (named Firebird Live CD) by adding an firebird-super-server and flamerobin packages | ||
我制作了一个小的定制光盘样例(名为"火鸟" Live CD),我在其中加入了firebird-super-server 和 flamerobin 包。 | 我制作了一个小的定制光盘样例(名为"火鸟" Live CD),我在其中加入了firebird-super-server 和 flamerobin 包。 http://flamerobin.blogspot.com/2006/05/creating-flamerobinfirebird-live-cd.html | ||
http://flamerobin.blogspot.com/2006/05/creating-flamerobinfirebird-live-cd.html | |||
---- | ---- | ||
第156行: | 第278行: | ||
首先,写得很好,很及时,谢谢。另外,这是我的评论: | 首先,写得很好,很及时,谢谢。另外,这是我的评论: | ||
* In '''Customizations''' One has to update /etc/resolv.conf in the chroot for network access | * In '''Customizations''' One has to update /etc/resolv.conf in the chroot for network access | ||
* 在“定制”步骤,为了访问网络,您需要更新在chroot中的 /etc/resolv.conf 。 | * 在“定制”步骤,为了访问网络,您需要更新在chroot中的 /etc/resolv.conf 。 | ||
第162行: | 第285行: | ||
* In '''Create ISO''' a sudo is needed. | * In '''Create ISO''' a sudo is needed. | ||
* 在“制作 ISO 文件”步骤,需要 sudo 命令。 | * 在“制作 ISO 文件”步骤,需要 sudo 命令。 | ||
---- | ---- | ||
第171行: | 第295行: | ||
特性: | 特性: | ||
* | |||
** GUI for simple creation of localized CDs (including changing gfxboot and installing language packs) | ** GUI for simple creation of localized CDs (including changing gfxboot and installing language packs) | ||
** 有简单制作本地化 CDs 的 GUI(包括改变 gfxboot 和 安装语言包) | ** 有简单制作本地化 CDs 的 GUI(包括改变 gfxboot 和 安装语言包) | ||
第183行: | 第309行: | ||
---- | ---- | ||
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. | 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. | ||
第188行: | 第315行: | ||
---- | ---- | ||
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. | |||
cp /etc/X11/xorg.conf edit/etc/X11/ | |||
2. Create generic devices on your chroot system using MAKEDEV | |||
cd /dev/ | |||
MAKEDEV generic | |||
3. Start X or restart gdm | |||
/etc/init.d/gdm start | |||
[[ | 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. | ||
export HOME=/etc/skel/ | |||
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. | |||
/etc/init.d/dbus start | |||
An example of the whole procedure. (under single-user mode) | |||
sudo /etc/init.d/networking restart | |||
sudo cp /etc/resolv.conf edit/etc/ | |||
sudo cp /etc/X11/xorg.conf edit/etc/X11/ | |||
sudo chroot edit | |||
mount -o none /proc | |||
mount -o none /sys | |||
export HOME=/etc/skel/ | |||
cd /dev/ | |||
MAKEDEV generic | |||
/etc/init.d/dbus start | |||
/etc/init.d/gdm start | |||
--- joelbryan | |||
---- | |||
[[Category:CategoryDocumentation]] |
2010年3月10日 (三) 05:26的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/LiveCDCustomization }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/af | • {{#if: UbuntuHelp:LiveCDCustomization|Afrikaans| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/ar | • {{#if: UbuntuHelp:LiveCDCustomization|العربية| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/az | • {{#if: UbuntuHelp:LiveCDCustomization|azərbaycanca| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/bcc | • {{#if: UbuntuHelp:LiveCDCustomization|جهلسری بلوچی| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/bg | • {{#if: UbuntuHelp:LiveCDCustomization|български| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/br | • {{#if: UbuntuHelp:LiveCDCustomization|brezhoneg| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/ca | • {{#if: UbuntuHelp:LiveCDCustomization|català| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/cs | • {{#if: UbuntuHelp:LiveCDCustomization|čeština| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/de | • {{#if: UbuntuHelp:LiveCDCustomization|Deutsch| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/el | • {{#if: UbuntuHelp:LiveCDCustomization|Ελληνικά| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/es | • {{#if: UbuntuHelp:LiveCDCustomization|español| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/fa | • {{#if: UbuntuHelp:LiveCDCustomization|فارسی| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/fi | • {{#if: UbuntuHelp:LiveCDCustomization|suomi| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/fr | • {{#if: UbuntuHelp:LiveCDCustomization|français| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/gu | • {{#if: UbuntuHelp:LiveCDCustomization|ગુજરાતી| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/he | • {{#if: UbuntuHelp:LiveCDCustomization|עברית| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/hu | • {{#if: UbuntuHelp:LiveCDCustomization|magyar| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/id | • {{#if: UbuntuHelp:LiveCDCustomization|Bahasa Indonesia| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/it | • {{#if: UbuntuHelp:LiveCDCustomization|italiano| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/ja | • {{#if: UbuntuHelp:LiveCDCustomization|日本語| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/ko | • {{#if: UbuntuHelp:LiveCDCustomization|한국어| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/ksh | • {{#if: UbuntuHelp:LiveCDCustomization|Ripoarisch| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/mr | • {{#if: UbuntuHelp:LiveCDCustomization|मराठी| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/ms | • {{#if: UbuntuHelp:LiveCDCustomization|Bahasa Melayu| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/nl | • {{#if: UbuntuHelp:LiveCDCustomization|Nederlands| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/no | • {{#if: UbuntuHelp:LiveCDCustomization|norsk| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/oc | • {{#if: UbuntuHelp:LiveCDCustomization|occitan| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/pl | • {{#if: UbuntuHelp:LiveCDCustomization|polski| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/pt | • {{#if: UbuntuHelp:LiveCDCustomization|português| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/ro | • {{#if: UbuntuHelp:LiveCDCustomization|română| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/ru | • {{#if: UbuntuHelp:LiveCDCustomization|русский| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/si | • {{#if: UbuntuHelp:LiveCDCustomization|සිංහල| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/sq | • {{#if: UbuntuHelp:LiveCDCustomization|shqip| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/sr | • {{#if: UbuntuHelp:LiveCDCustomization|српски / srpski| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/sv | • {{#if: UbuntuHelp:LiveCDCustomization|svenska| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/th | • {{#if: UbuntuHelp:LiveCDCustomization|ไทย| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/tr | • {{#if: UbuntuHelp:LiveCDCustomization|Türkçe| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/vi | • {{#if: UbuntuHelp:LiveCDCustomization|Tiếng Việt| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/yue | • {{#if: UbuntuHelp:LiveCDCustomization|粵語| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/zh | • {{#if: UbuntuHelp:LiveCDCustomization|中文| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/zh-hans | • {{#if: UbuntuHelp:LiveCDCustomization|中文(简体)| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCDCustomization | UbuntuHelp:LiveCDCustomization | {{#if: | :}}老旧文章/UbuntuHelp:LiveCDCustomization/zh}}/zh-hant | • {{#if: UbuntuHelp:LiveCDCustomization|中文(繁體)| [[::老旧文章/UbuntuHelp:LiveCDCustomization/zh/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:LiveCDCustomization|:老旧文章/UbuntuHelp:LiveCDCustomization/zh|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :老旧文章/UbuntuHelp:LiveCDCustomization/zh/zh | | {{#ifexist: 老旧文章/UbuntuHelp:LiveCDCustomization/zh/zh | | {{#ifeq: {{#titleparts:老旧文章/UbuntuHelp:LiveCDCustomization/zh|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:老旧文章/UbuntuHelp:LiveCDCustomization/zh|1|-1|}} | zh | | }}
如何定制Ubuntu图形安装光盘
你或许基于以下原因定制UBUNTU桌面(LIVE)版:
- 预装特定的程序
- 本地化语言支持
- 移出软件安装包
- 添加软件安装包
- 更新软件安装包
- 改变系统默认设置 (主题、图标、桌面、面板、浏览器主页等等)
本向导针对桌面版/LIVE CD,定制文字安装光盘和服务器安装光盘请参考其他页面。
系统需求
- 至少3-5 GB的空闲磁盘空间
- 至少512MB内存和1GB交换分区(推荐)
- squashfs-tools 用以压缩文件系统
- mkisofs
- 一个支持squashfs的Ubuntu内核(Ubuntu6.06以及更高版本)
- QEMU、VirtualBox或VMware用于测试(可选)
过程
首先,请确认你安装了必要的工具:
sudo apt-get install squashfs-tools mkisofs qemu
加载 squashfs 模块
sudo modprobe squashfs
你需要从 http://releases.ubuntu.com/ 下载一张官方的图形安装光盘
注:以Ubuntu-7.10-desktop-i386.iso为例
把它移动或者复制到一个空的目录:
mkdir ~/live mv ubuntu-7.10-desktop-i386.iso ~/live cd ~/live
释放出光盘的内容
挂载桌面系统 .iso
mkdir mnt sudo mount -o loop ubuntu-7.10-desktop-i386.iso mnt
把 .iso 的内容释放到 'extract-cd' 目录
mkdir extract-cd rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd
释放桌面系统
加载 squashfs 文件系统
mkdir squashfs sudo mount -t squashfs -o loop mnt/casper/filesystem.squashfs squashfs
把 squashfs 内容释放到 'edit' 目录
mkdir edit sudo cp -a squashfs/* edit/
准备以及虚拟根目录
如果你需要在虚拟根系统内使用网络连接
sudo cp /etc/resolv.conf edit/etc/
根据你的配置,你也许需要复制hosts文件
sudo cp /etc/hosts edit/etc/
sudo chroot editmount -t proc none /proc mount -t sysfs none /sys mount -t devpts none /dev/pts
为了避免区域问题以及导入GPS key
export HOME=/root export LC_ALL=C
定制
预装软件
根据大小查看被安装的软件包
dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less
移去软件包使用purge参数
apt-get remove --purge package name
设置GNOME的桌面
通常桌面文件位于/usr/share/backgrounds。复制你的PNG文件到那里并编辑下面的文档:
1. /usr/share/gnome-background-properties/ubuntu-wallpapers.xml 2. /etc/gconf/gconf.xml.defaults/%gconf-tree.xml
更改字符串 /usr/share/backgrounds/warty-final-ubuntu.png 指向你的文件。
更改 gconf (字体、面板等等)
对 gconf 的任何设置变更都必须在 /etc/gconf/gconf.xml.defaults/%gconf-tree.xml文件中添加相应的值。 在此文件中的操作可以变更 GNOME 或者其他程序的默认设置,因此你能修改字体,桌面,主题,指针等。
可替代为 gedit 或者其他文本编辑器,你能在 chroot 环境下,使用 gconftool-2运行以下命令:
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set yourkey "yourvalue"
在这里 string, yourkey 和 yourvalue 是你需要修改的部分。
更改gfxboot的默认语言
这部分定制需要在chroot进行。
sudo -s apt-get install dpkg-dev apt-get source gfxboot-theme-ubuntu gfxboot cd gfxboot-theme-ubuntu*/ make DEFAULT_LANG=fi sudo cp -af boot/* ../extract-cd/isolinux/ exit
更改 "fi"为你的本地语言。注意这个修改不会影响 F2 菜单中选项。要了解更多关于 gfxboot 定制的内容请访问 Ubuntu Customization Kit。
* 变更 gfxboot 默认语言的另一种方法是 A other way to change the default language of gfxboot without rebuild the packages is to create a file name lang in the isolinux directory containing your locale's name.
Customization limits
After customization make sure that there are no users with an UID >= 1000. Otherwise your image won't boot because no initial user is available (see /usr/lib/user-setup/functions.sh and /usr/lib/user-setup/user-setup-apply). While in chroot:
grep '^[^:]*:[^:]*:[1-9][0-9][0-9][0-9]:' /etc/passwd grep '^[^:]*:[^:]*:[12][0-9][0-9][0-9][0-9]:' /etc/passwd
If you get any hits, try changing the uid:
usermod -u 500 $hit
高级定制
图形安装光盘内核
If you want to customize further the boot process, you can change the livecd kernel, by copying the vmlinuz and initrd you want in place of the ones you find in extract-cd/casper (don't forget to apt-get the right kernel, the one that matches the livecd one, once chrooted into edit).
i.e.
sudo cp /boot/vmlinuz-2.6.15-26-k7 extract-cd/casper/vmlinuz sudo cp /boot/initrd.img-2.6.15-26-k7 extract-cd/casper/initrd.gz
启动设置
You have to edit the files in edit/usr/share/initramfs-tools/scripts/casper-bottom/* For example you can change the hostname or the livecd user.
i.e.
sudo nano edit/usr/share/initramfs-tools/scripts/casper
and edit the username or hostname
sudo nano edit/usr/share/initramfs-tools/scripts/casper-bottom/10adduser
to edit even the livecd user's password.
P.S. in order to obtain an encrypted password, you have to use the mkpasswd program that's shipped with whois package!
重建initrd
After you've modified the kernel, init scripts or added new kernel modules, you need to rebuild the initrd.gz file and substitute it into the casper directory.
sudo chroot edit mkinitramfs -o /initrd.gz 2.6.15-26-k7
(replace the kernel version with the one that the CD will boot with - this can be found in edit/lib/modules)
Exit from the chroot jail and move this file to extract-cd/casper:
exit mv edit/initrd.gz extract-cd/casper/
清理
Be sure to remove any temporary files which are no longer needed, as space on a CD is limited. A classic example is downloaded package files, which can be cleaned out using:
apt-get clean
Or delete temporary files
rm -rf /tmp/*
Or nameserver settings
rm /etc/resolv.conf
now umount (unmount) special filesystems and exit chroot
umount /proc umount /sys umount /dev/pts exit
整合光盘
Regenerate manifest
chmod +w extract-cd/casper/filesystem.manifest sudo chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest sudo cp extract-cd/casper/filesystem.manifest extract-cd/casper/filesystem.manifest-desktop sudo sed -ie '/ubiquity/d' extract-cd/casper/filesystem.manifest-desktop
Compress filesystem
sudo rm extract-cd/casper/filesystem.squashfs sudo mksquashfs edit extract-cd/casper/filesystem.squashfs
Set an image name in extract-cd/README.diskdefines
sudo vim extract-cd/README.diskdefines
Remove old md5sum.txt and calculate new md5 sums
sudo -s rm extract-cd/md5sum.txt (cd extract-cd && find . -type f -print0 | xargs -0 md5sum > md5sum.txt) exit
Create Iso
cd extract-cd sudo mkisofs -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-6.06.2-desktop-i386-custom.iso .
测试光盘
使用QEMU虚拟机测试
qemu -cdrom ubuntu-7.10-desktop-i386-custom.iso -boot d
你也可以使用 Virtualbox-ose 进行测试,在 Ubuntu 的软件库中可以找到它。
烧录光盘
简单!如下:
cdrecord dev=/dev/cdrom ubuntu-7.10-desktop-i386-custom.iso
评论
If you have any comments or questions, please feel free to add them here.
如果您有任何意见或者疑问,您可以放心地把它写到这里。
I have created an small Customization Example (named Firebird Live CD) by adding an firebird-super-server and flamerobin packages
我制作了一个小的定制光盘样例(名为"火鸟" Live CD),我在其中加入了firebird-super-server 和 flamerobin 包。 http://flamerobin.blogspot.com/2006/05/creating-flamerobinfirebird-live-cd.html
1st off great write-up and very timely, THX. 2nd here are my comments
首先,写得很好,很及时,谢谢。另外,这是我的评论:
- In Customizations One has to update /etc/resolv.conf in the chroot for network access
- 在“定制”步骤,为了访问网络,您需要更新在chroot中的 /etc/resolv.conf 。
- In Calculate MD5sums the text needs to be updated. There are read permission errors on the the filesystem.squashfs and md5sums.txt in the extract-cd cannot be written. I worked around this by cd'ing into extract-cd and temporarily changing the permission on casper/filesystem.squashfs to allow reading. Also, the md5sums file was created in .. and then copied over with sudo.
- 在“计算 MD5 Sum”步骤,需要有些修改。由于在 extract-cd 中的 filesystem.squashfs 和 md5sums.txt 不能被写入,这会导致权限错误。我通过cd 进入 extract-cd ,然后临时改变 casper/filesystem.squashfs 的权限,让它可读,这样就解决了这个问题。md5sums文件被建立在..中,然后用sudo命令复制过来。
- In Create ISO a sudo is needed.
- 在“制作 ISO 文件”步骤,需要 sudo 命令。
I have created tool for automatic remastering of live CD images. See http://lichota.net/~krzysiek/projects/ubuntu-livecd-customization/ .
我制作了一个自动重新灌录 Live CD 镜像的工具。参见 http://lichota.net/~krzysiek/projects/ubuntu-livecd-customization/ 。
Features:
特性:
-
- GUI for simple creation of localized CDs (including changing gfxboot and installing language packs)
- 有简单制作本地化 CDs 的 GUI(包括改变 gfxboot 和 安装语言包)
- Script for customization of ISO, SquashFS and initrd on live CD.
- Live CD 中包含定制 ISO,SquasFS 和 initrd 的脚本
I think we also need a small documentation about customizing gfxboot, at least something about changing the default language.
我想我们需要一篇关于如果定制 gfxboot 的文档,至少要涉及如何改变默认的语言。
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.
在 http://www.atworkonline.it/~bibe/ubuntu/custom-livecd.htm 上有很好的信息。我没有看到有关的许可信息,所以我们用到它的资源时需要得到作者的许可。
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.
cp /etc/X11/xorg.conf edit/etc/X11/
2. Create generic devices on your chroot system using MAKEDEV
cd /dev/ MAKEDEV generic
3. Start X or restart gdm
/etc/init.d/gdm start
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.
export HOME=/etc/skel/
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.
/etc/init.d/dbus start
An example of the whole procedure. (under single-user mode)
sudo /etc/init.d/networking restart sudo cp /etc/resolv.conf edit/etc/ sudo cp /etc/X11/xorg.conf edit/etc/X11/ sudo chroot edit mount -o none /proc mount -o none /sys export HOME=/etc/skel/ cd /dev/ MAKEDEV generic /etc/init.d/dbus start /etc/init.d/gdm start
--- joelbryan