Ubuntu ISO定制

本文详述了Ubuntu ISO的定制过程,包括发行版本的选择,如Kubuntu、Lubuntu等,以及Desktop、Server、Alternate的区别。重点介绍了基于Lubuntu 18.04 Alternate的定制,涉及preseed文件用于自动化安装,以及修改isolinux.cfg和grub.cfg来识别自定义文件。最后提到了使用mkisofs制作ISO和rufus创建启动U盘的步骤。
部署运行你感兴趣的模型镜像

最近在进行Ubuntu ISO的定制,将其过程进行简单的记录。

1.Ubuntu发行版本的选择

  1. Kubuntu::使用的是KDE桌面环境
  2. Lubuntu:最新的版本使用的是LXQT桌面环境,之前的版本使用的是LXDE桌面环境
  3. Ubuntu Budgie:使用的是Budgie桌面环境
  4. Ubuntu Kylin:是麒麟的版本
  5. Ubuntu MATE:使用的是MATE桌面环境
  6. Ubuntu Studio:侧重于音视频和图像处理
  7. Xubuntu:使用的是Xfce桌面环境

可以看到,各个版本之间的主要差异是桌面环境和安装的软件包的区别。

2.Desktop or Server or Alternate?

ubuntu iso下载路径:http://cdimage.ubuntu.com/

在下载ubuntu iso的时候,需要在desktop, server, alternate之间进行选择,三者之间的主要差异可参考:https://askubuntu.com/questions/17952/what-are-the-differences-between-desktop-server-and-alternate-installs

  1. Desktop:可以在安装之前试用,使用的是Ubiquity installer
  2. Server:不包含桌面环境,使用的是debian-installer
  3. Alternate:包含桌面环境,还包含了"OEM Install"(可以将个性化的设置留到第一次开机启动时进行),使用的是debian-installer

本文是基于Lubuntu 18.04 alternate进行定制,其桌面环境是LXDE,下载路径:http://cdimage.ubuntu.com/lubuntu/releases/18.04/release/lubuntu-18.04-alternate-amd64.iso

3.定制过程

Alternate ISO定制过程可参考:https://help.ubuntu.com/community/InstallCDCustomization

  1. 将ISO中内容复制出来
  2. 使用preseed文件修改debian-installer的行为:preseed文件为安装过程中的问题提前设置好答案,可以免去安装中手动选择的过程,能够实现全自动安装。参考:https://help.ubuntu.com/lts/installation-guide/amd64/apb.html
  3. 修改isolinux.cfg,让其识别自定义的preseed文件
  4. 修改grub.cfg,让其识别自定义的preseed文件
  5. 制作ISO,使用的工具为mkisofs
  6. 制作U盘启动,使用的工具为rufus,该工具仅有windows版,制作启动U盘时分区类型要选择"MBR",目标系统类型要选择"BIOS或uEFI"

4.将ISO中内容复制出来

#!/bin/bash

UBUNTU_ISO=$1
DIR="$( cd "$( dirname "$0"  )" && pwd  )"
BUILD=$DIR/cd-image
TMP_DIR=$DIR/tmp-$DATE/ # tailing / is nessary so that rsync will work well

# copy iso contents to build dir
mkdir -p $BUILD
mkdir -p $TMP_DIR
mount $UBUNTU_ISO $TMP_DIR
rsync -av $TMP_DIR $BUILD
umount $TMP_DIR
rm -rf $TMP_DIR

5.preseed文件

d-i debian-installer/locale string en_US
d-i debian-installer/language string en
d-i debian-installer/country string NL
d-i debian-installer/locale string en_GB.UTF-8
d-i localechooser/supported-locales multiselect en_US.UTF-8, nl_NL.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
d-i keyboard-configuration/toggle select No toggling
d-i netcfg/enable boolean false
d-i netcfg/choose_interface select auto
d-i netcfg/link_wait_timeout string 10
d-i netcfg/dhcp_timeout string 60
d-i netcfg/dhcpv6_timeout string 60
d-i netcfg/get_hostname string custom-host
d-i netcfg/get_domain string custom-domain
d-i netcfg/hostname string customhost
d-i netcfg/wireless_wep string
d-i hw-detect/load_firmware boolean true
d-i mirror/country string manual
d-i mirror/http/hostname string archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string
d-i passwd/root-login boolean true

d-i passwd/root-password password 123456
d-i passwd/root-password-again password 123456
d-i passwd/user-fullname string custom user
d-i passwd/username string custom
d-i passwd/user-password password 123456
d-i passwd/user-password-again password 123456
d-i passwd/user-uid string 1010
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
d-i clock-setup/utc boolean false
d-i time/zone string Asia/Shanghai
d-i clock-setup/ntp boolean true
d-i partman-auto/disk string /dev/sda
d-i partman-auto/choose_recipe select atomic
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm boolean true
d-i partman/default_filesystem string ext4
d-i partman/mount_style select uuid
d-i base-installer/install-recommends boolean false
d-i base-installer/kernel/image string linux-generic
d-i apt-setup/use_mirror boolean false
tasksel tasksel/first multiselect lubuntu-core lxde-core
d-i pkgsel/language-packs multiselect zh
d-i pkgsel/install-language-support boolean false
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean true
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev  string /dev/sda
d-i grub-installer/bootdev  string default
d-i finish-install/keep-consoles boolean true
d-i finish-install/reboot_in_progress note
d-i debian-installer/exit/poweroff boolean true

6.isolinux.cfg文件

default autoinstall
prompt 0
timeout 10
menu title Custom CD
menu background splash.png
menu color title 1;37;44 #c0ffffff #00000000 std
 label autoinstall
menu label autoinstall - auto install customcd
kernel /install/vmlinuz
append initrd=/install/initrd.gz file=/cdrom/preseed/custom.seed boot=install debian-installer/locale=en_US console-setup/ask_detect=false keyboard-configuration/layoutcode=us automatic-ubiquity quiet splash --

7.grub.cfg文件

if loadfont /boot/grub/font.pf2 ; then
        set gfxmode=auto
        insmod efi_gop
        insmod efi_uga
        insmod gfxterm
        terminal_output gfxterm
fi

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray

set timeout=30
menuentry "Install customcd" {
        set gfxpayload=keep
        linux   /install/vmlinuz  file=/cdrom/preseed/custom.seed FRONTEND_BACKGROUND=original debian-installer/locale=en_US console-setup/ask_detect=false keyboard-configuration/layoutcode=us automatic-ubiquity quiet splash ---
        initrd  /install/initrd.gz
}
menuentry "Rescue a broken system" {
        set gfxpayload=keep
        linux   /install/vmlinuz  rescue/enable=true ---
        initrd  /install/initrd.gz
}

8.制作ISO的命令

mkisofs -U -r -v -T -J -joliet-long -V "Custom CD" \
        -volset "Custom CD" \
        -A "Custom CD" -b isolinux/isolinux.bin \
        -c isolinux/boot.cat -no-emul-boot \
        -boot-load-size 4 -boot-info-table \
        -eltorito-alt-boot -iso-level 3 -allow-limited-size \
        -e boot/grub/efi.img -no-emul-boot \
        -o ./custom.iso ./cd-image/

 

您可能感兴趣的与本文相关的镜像

Seed-Coder-8B-Base

Seed-Coder-8B-Base

文本生成
Seed-Coder

Seed-Coder是一个功能强大、透明、参数高效的 8B 级开源代码模型系列,包括基础变体、指导变体和推理变体,由字节团队开源

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值