当前位置: > Linux发行版 > Debian >

Debian-Live构建系统安装镜像示例

时间:2021-12-18 16:56来源:linux.it.net.cn 作者:IT

环境说明

Debian 8(Jessie)

更改国内源,加快打包速度

# vim config/build
# vim config/bootstrap
# vim config/binary

配置

# mkdir test-image && cd test-image
# lb config \
--debian-installer live \
--iso-application "Test v1" \
--iso-preparer "Live Build v4" \
--iso-publisher test \
--iso-volume "Test v1"

注意:执行lb config命令会重置auto/config文件的配置,一定要先备份配置文件再执行此命令。

安装标准软件

# echo '! Packages Priority standard' > config/package-lists/standard.list.chroot

安装软件

# echo "ntpdate python python-pip openvpn easy-rsa supervisor ssh python2.7-dev shellinabox" > config/package-lists/vpn.list.chroot

安装debian-installer

# echo debian-installer-launcher > config/package-lists/installer.list.chroot

添加系统源:

echo "deb http://ftp.debian.org/debian/ jessie main" > config/archives/live.list.chroot
echo "deb http://ftp.debian.org/debian/ jessie main" > config/archives/live.list.binary

自定义内容

例如:内容放置目录为config/includes.chroot

# mkdir -p config/includes.chroot/var/www
# cp /path/to/my/index.html config/includes.chroot/var/www

Hooks

脚本放置目录:config/hooks/

*.hook.chroot
*.hook.binary

脚本:

# vim config/hooks/vpn.hook.chroot
#!/bin/sh
#
echo "HOOK: Load ip forward"
echo 1 > /proc/sys/net/ipv4/ip_forward
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
sysctl -p

echo "HOOK: Config openvpn"
cd /etc/openvpn/
cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz ./
cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf ./
cp /usr/share/easy-rsa/* ./
gunzip server.conf.gz

echo "HOOK: Config supervisor"
sed -i '$i\/usr/bin/supervisord' /etc/rc.local
# chmod u+x config/hooks/vpn.hook.chroot

Customizing the binary image

# mkdir -p config/bootloaders
# cp -r /usr/share/live/build/bootloaders/* config/bootloaders/

#修改isolinux目录下的文件定制启动画面
# vim config/bootloaders/isolinux/install.cfg
label install
        menu label ^Test Install
        linux /install/vmlinuz
        initrd /install/initrd.gz
        append vga=788 @APPEND_INSTALL@ -- quiet
		
# vim config/bootloaders/isolinux/menu.cfg
menu hshift 0
menu width 82

menu title Boot Menu
include install.cfg

menu clear

#修改启动背景图片
splash.svg --> splash.png

Customizing Debian Installer by preseeding

# echo "d-i debian-installer/locale string en_US" >> config/includes.installer/preseed.cfg
# vim config/includes.installer/preseed.cfg

创建镜像

# lb build



(责任编辑:IT)
------分隔线----------------------------