Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1819976
  • 博文数量: 473
  • 博客积分: 13997
  • 博客等级: 上将
  • 技术积分: 5953
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-22 11:52
文章分类

全部博文(473)

文章存档

2014年(8)

2013年(38)

2012年(95)

2011年(181)

2010年(151)

分类: LINUX

2011-05-20 00:31:15

Debian Live 是一款制作可从移动介质直接启动的 Linux 系统的工具,支持生成 iso 镜像,USB 磁盘镜像和 NFS 镜像。

Debian Live 定制性很强,下面简单介绍几项定制内容:

1. 定制 Debian Mirror 地址

如果你的工作机无法访问官方 mirror,一定要通过下面 lh_config 的 5 个参数,配置可以访问的 mirror:

lh_config
[-m|--mirror-bootstrap URL]
[--mirror-binary URL]
[--mirror-binary-security URL]
[--mirror-chroot URL]
[--mirror-chroot-security URL]

2. 定制 syslinux splash 图像

syslinux 使用一种特殊的图像格式(RLE 或 LSS),需要用下面的方法准备:

  • 用 GIMP 编辑图像,不要超过 640×400。
  • 设置为 14 Indexed Color。如果图像已经为 Indexed Color,但超过 14 种,应该先转换成 RGB 格式,再转换回 14 Indexed Color
  • 另存为 PPM 格式
  • 使用 syslinux 包中的 ppmtolss16,将 PPM 图像转换成 LSS
  • ppmtolss16 '#d0d0d0=7' < splash.ppm > splash.rle

得到 LSS 格式的图像之后,需要:

  • 放入 config/binary_syslinux/ 下,假设文件名为 splash.rle
  • 同时修改 config/binary,设置:
  • LH_SYSLINUX_SPLASH="config/binary_syslinux/splash.rle"

然后 lh_clean && lh_build 生成新的镜像。

3. 定制默认用户配置

Debian 以及其他 Linux 发行版在创建新用户时,会将 /etc/skel 目录下的所有文件复制到新用户 HOME 目录下。借助这一特色,可以通过将配置文件放在 /etc/skel 目录下,起到默认配置的作用。

Debian Live 系统每次启动时会生成全新用户 HOME 目录,同样会拷贝 /etc/skel 目录下的所有文件。因此需要将配置文件放入 Debian Live 系统的 /etc/skel 目录下。

在 config/chroot_local-includes/ 目录下,创建 etc/skel 子目录,在生成 binary 时,这些文件会自动拷贝到文件系统上。

lh_clean && lh_build 生成新的镜像。

4. 定制 splashy

splashy 可以在系统启动时,显示图形化的进度栏。splashy 的定制过程如下:

  • 创建 config/chroot_local-hooks/01-splash.sh:
  • #!/bin/sh
    splashy_config -s debian-moreblue || true
    update-initramfs -u -k all
  • chmod +x config/chroot_local-hooks/01-splash.sh
  • 修改 config/chroot 文件,LH_PACKAGES 后增加两个包:splashy splashy-themes

最后,lh_clean && lh_build 生成新的镜像。

5. 定制 usplash

usplash 与 splash 类似,同样可以显示图形化启动进度。由于 splashy 不支持 initramfs,有一部分启动过程无法图形化,而 usplash 能弥补这一缺陷。

  • 参照 splashy 前两步,生成同样的 01-splash.sh 可执行脚本
  • 修改config/chroot 文件,LH_PACKAGES 后增加两个包:usplashy usplash-theme-debian
    最后,lh_clean && lh_build 生成新的镜像。

6. 最小化生成 image

通常减少 Debian/Linux 系统空间的方法无外乎:1 删除不用的 locale 信息,2 删除 APT 缓存。可以参照上面定制过程,在 config/chroot_local-hooks/ 目录下,创建 hooks 脚本实现。

  • 首先,修改config/chroot 文件,LH_PACKAGES 后添加 localepurge
  • 创建 config/chroot_local-hooks/99-clean.sh 文件:
  • #!/bin/sh
    rm -r /var/lib/apt/lists/mirror.ivic.org.cn*
    rm -r /var/cache/apt/*.bin
     
    debconf-set-selections <debconf localepurge/nopurge select en, en_US.UTF-8
    debconf localepurge/nopurge seen true
     
    debconf localepurge/mandelete select true
    debconf localepurge/mandelete seen true
     
    debconf localepurge/dontbothernew select false
    debconf localepurge/dontbothernew seen true
     
    debconf localepurge/showfreedspace select true
    debconf localepurge/showfreedspace seen true
     
    debconf localepurge/verbose select false
    debconf localepurge/verbose seen true
     
    debconf localepurge/quickndirtycalc select true
    debconf localepurge/quickndirtycalc seen true
    EOF

     
    dpkg-reconfigure -u -phigh localepurge
  • chmod +x config/chroot_local-hooks/99-clean.sh

最后 lh_clean && lh_build 生成新的镜像。

7. 使用 fluxbox

fluxbox 是一款小巧的 X Window Manager。生成使用 fluxbox 的 Debian Live 系统的过程如下:

  • 修改config/chroot 文件,LH_PACKAGES_LISTS 后添加 fluxbox(替换 xfce/gnome/kde 等)
  • 创建 chroot_local-packageslists/fluxbox,内容如下:
  • ## LH: Fluxbox
    #include

    fluxbox gdm
    ##desktop-base

最后 lh_clean && lh_build 生成新的镜像。


##################################################

定制一个自己的的Debian CD

基本步骤:1.下载网络安装盘,这是修改的iso源盘
2.用这张盘安装基本系统,重启后,装其他需要的东西,记得最好在base-config后apt-get 那样你需要的软件包都在/var/cache/apt/archives/目录下
(默认的base-config会在装完系统后删除这些包)
3.把这些软件包拷入一个目录,如/root/debs,并建本地库
4.把网络安装盘挂载,将文件拷到一个目录下,加入debs目录。重新校验md5
以上是大概步骤,思路。
具体举例:
1. 选一个有iso镜像的站点,我用的是debian.cn99.com,我的速度有1M多。http: //debian.cn99.com/debian-cd/debian-31r0a-i386-netinst.iso下载他并刻录到可檫写的光盘,用 来安装系统(最好有这样的盘,就不会错了浪费光盘了)。记得一定用这个装,不要加载其他软件盘的东西。
2.netinst装完后就有一个基本系 统,重启进入base-config,这里记得一点,在选择sources.list的源时,先不要加光盘外的其他源.你的sources.list里只 有你的netinst的源就对了。如果加入如debian.cn99.com,系统会自动装许多东西,而且装完后删除已下载的包。那你就要一个个的比较, 在把那些包找到下载下来,这是一个辛苦的工作。
3.有光盘的源的目的时保证当你光盘有需要的包时,不从网上下载,以确保软件包不重复。
4.base-config完成后,登入系统,定制正式开始。
5.先加入你需要的源到sources.list.然后apt-get安装。(系统默认情况下,这些包都会下载到/var/cache/apt/archives/下,并且不会删除)
6.建议你在装软件时看看你的/var/cache/apt/archives/的大小,如果只做一张碟的话,550M就够多了
7.如果你有其他的deb包,如chmsee等不是apt-get 的软件,把它拷入/var/cache/apt/archives/后dpkg -i 来安装。
8.如果是其他包,如realplay.bin都等,放入一个目录,如/root/tools,安装。
9. 当一切都装完后,你的系统本身就是用这些软件包装成的了,你的安装盘装的系统大约也是这样了,这是你就需要检查,试用下,看是不是缺少东西了,少就装上。 还有需要些手动修改的地方,用一个文本文件记录下来,我一般是建一个faq.txt,把如fcitx的环境变量设置说明放到里面。
10.一切准备好了后,开始制作
11.把/var/cache/apt/archives/里的deb文件拷入/root/debs/下
12.建立本地库。
cd /root
dpkg-scanpackages debs /dev/null | gzip > debs/Packages.gz
如果没有dpkg-scanpackages,请安装dpkg-dev
13.测试本地库
在 sources.list下加入
deb file:/root/debs ./
并把其他的源都屏蔽,加上"#",光盘的源保留
apt-get update
卸载一个软件,然后在装试试,如果可以安装并且不从网上下载软件包就对了
建议用synaptic看,比较直观。
14.挂载光盘。如mount /dev/cdrom /media/cdrom
15.建立目录用以编辑iso文件,不要用window下的winiso等工具,校验通不过的。
我这里建一个目录如/file/1,将/media/cdrom下的文件和目录都拷入/file/1下。
把/root下的debs目录拷入/file/1,将其他软件包拷入/file/1/tools/.配置文件faq.txt等放入/file/1/doc下
16.重新打包md5
#cd /file/1

# rm -f md5sums; find -type f -not -name md5sums -not -name boot.cat -exec md5sum {} \; >> md5sums.txt
这一步比较重要,不然你的光盘是通不过校验的,完成后看看你的md5sums.txt里有新加的/debs吗,有的话就对了。记得加了校验后不要在修改东西。不然就要重新校验。
17.制作iso镜像
cd /file/1

mkisofs -o /root/debiansarge.iso -r -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table /file/1


阅读(1563) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~