- 官方推薦了 build-simple-cdd 來 定製Debian安裝盤 。
sudo apt-get -y install simple-cdd xorriso
- 建立基礎目錄和文件:
# 使用普通用戶便可,jessie-iso爲光盤根目錄
# profiles 爲配置文件目錄,custom-deb 爲定製包目錄,extra-file 裏的文件會拷貝到光盤的 simple-cdd 目錄下。
mkdir -pv ~/jessie-iso/{profiles,custom-deb,extra-file}
dpkg -l |awk '/^[hi]i/{print $2}' | awk -F':' '{print $1}' > ~/jessie-iso/profiles/bilibili.packages
# 會默認使用基礎配置文件: /usr/share/simple-cdd/profiles/
ls ~/jessie-iso/profiles/ # 添加額外定製配置
bilibili.conf # build-simple-cdd 主配置文件
bilibili.downloads # 指定要下載到光盤裏的安裝包
bilibili.packages # 指定將被安裝的包
bilibili.preseed # 執行的自動安裝腳本
- 下載安裝包、生成光盤目錄數據,大功告成:
build-simple-cdd -p bilibili
# 默認會有個base系統,定製的配置文件只須要加入自定義部分便可
build-simple-cdd --conf profiles/bilibili.conf --graphical-installer --security-mirror http://mirrors.bilibili.co/debian-security
# 執行完成會自動生成安裝光盤:
file ~/jessie-iso/images/debian-8.2-amd64-CD-1.iso
- 也可定製後手動生成光盤鏡像ISO文件:
cd ~/jessie-iso/tmp/cd-build/jessie
# boot1 目錄下包含了 isolinux 引入所需文件
# CD1 即除去 isolinux 下全部文件,便可按需修改
xorriso -as mkisofs -r -checksum_algorithm_iso md5,sha1 -V 'Debian 8.2 by Bilibili' -o ~/jessie-iso/images/debian-8.2-amd64-CD-1.iso -J -joliet-long -cache-inodes -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot boot1 CD1
- ~/jessie-iso/profiles/bilibili.conf 示例:
ARCH="amd64"
dist="jessie"
profiles_udeb_dist="jessie"
BOOT_TIMEOUT=50
locale="en_US"
keyboard="us"
use_qemu=false
proposed_updates=true
graphical_installer=true
force_preseed=true
KERNEL_PARAMS="vga=788"
vga_normal=false
auto_profiles="bilibili"
qemu_opts="-curses -no-reboot"
debian_mirror="http://mirrors.yun-idc.com/debian"
security_mirror="http://mirrors.yun-idc.com/debian-security"
mirror_components="main contrib non-free"
all_extras="$(find $(pwd)/extra-file -type f)"
local_packages="$(pwd)/custom-deb"
- ~/jessie-iso/profiles/bilibili.packages 示例:
# 如下非官方包都手動置入 ~/jessie-iso/custom-deb 目錄中
vim
bridge-utils
ifenslave-2.6 # 網卡橋接、綁定
firmware-linux-nonfree # 經常使用驅動
firmware-bnx2x # 博科10G網卡驅動
megaraid-sas-dkms # Mega的Raid驅動
openssh-server
build-essential
iproute
bash-completion
command-not-found
- 常見錯誤
# 不推薦用root執行,但普通用戶就提示這個。忽略便可:
debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat:
權限不夠
# 安全性有點高,這種提示忽略:
缺乏「Last-modified」文件頭 -- 關閉時間戳標記。
# 有些自定義的包打得不標準,不被拒絕安裝:
No section given for 'docker-engine', skipping.
# 這個警告一直有,忽略:
Use of uninitialized value $default_desktop in regexp compilation at ~/jessie-iso/tmp//debian-cd/tools/update_tasks line 239.
# 表明有些指定的安裝包缺失,打包失敗。不會製做iso。這種狀況可能使用對應源,手動安裝 vim 也失敗
ERROR: missing required packages from profile bilibili: vim
- 引導系統中加入驅動,示例:
mkdir -pv ~/jessie-iso/initrd && cd ~/jessie-iso/initrd # 解包
gunzip < ~/jessie-iso/tmp/cd-build/jessie/CD1/install.amd/gtk/initrd.gz | cpio --extract --preserve --verbose # 加驅動
dpkg -X ~/jessie-iso/custom-deb/firmware-linux-nonfree_0.43_all.deb ~/jessie-iso/initrd
dpkg -X ~/jessie-iso/custom-deb/firmware-bnx2x_0.43_all.deb ~/jessie-iso/initrd # 從新打包
find . | cpio --create --'format=newc' | gzip > ~/jessie-iso/tmp/cd-build/jessie/CD1/install.amd/gtk/initrd.gz
~/jessie-iso/tmp/cd-build/jessie/boot1/isolinux/ # 修改引導配置,略
~/jessie-iso/tmp/cd-build/jessie/CD1/ # 修改光盤內容,略
cd tmp/cd-build/jessie/
xorriso -as mkisofs -r -checksum_algorithm_iso md5,sha1 -V 'Debian 8.2 by Bilibili' -o ~/jessie-iso/images/debian-8.2-amd64-CD-1.iso -J -joliet-long -cache-inodes -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot boot1 CD1