ubuntu系统定制(2204)

1、定制需求
1.定制壁纸
2.定制软件(dcoker,docker-compose,ssh等)
3.定制安装(自动化安装)
2、实现步骤
/casper 目录通常包含用于引导和运行 Ubuntu Live 环境所需的所有文件。除了内核映像,它还包括一个初始内存磁盘映像(initrd)、文件系统映像和其他配置文件。
mkdir /mnt/iso
mount ubuntu-22.04-desktop-amd64.iso /mnt/iso
cp -rp /mnt/iso/. livecd
umount /mnt/iso

unsquashfs filesystem.squashfs
sudo cp /etc/resolv.conf squashfs-root/etc/resolv.conf
sudo chroot squashfs-root
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts

安装软件

apt install openssh-server
apt install vim
apt install docker-compose
apt install docker
vim /etc/docker/daemon.json
{ "insecure-registries":["10.18.1.2:5000"] }

adduser sder
adduser sder sudo
gpasswd -a sder docker
newgrp docker

重新打包

umount /proc
umount /sys
umount /dev/pts
mksquashfs squashfs-root filesystem.squashfs

重新生成md5

rm md5sum.txt
find -type f -print0 | xargs -0 md5sum | grep -v isolinux/boot.cat | tee md5sum.txt

efi启动模式iso

xorriso -as mkisofs -iso-level 3 -o ks_ubuntu2204.iso -full-iso9660-filenames -volid "ks Ubuntu 22.04 LTS" -eltorito-alt-boot -e EFI/boot/bootx64.efi -no-emul-boot -isohybrid-gpt-basdat livecd/

这里不用efi,否则biso没开启uefi不能启动安装

xorriso -as mkisofs -iso-level 3 -o ks_ubuntu2204.iso -full-iso9660-filenames -volid "ks Ubuntu 22.04 LTS" -boot-info-table --grub2-boot-info -eltorito-alt-boot -b 'boot/grub/i386-pc/eltorito.img' -no-emul-boot -isohybrid-gpt-basdat livecd/
解决软件源无法下载(记得要还原):
cp /etc/resolv.conf squashfs-root/etc/resolv.conf
vi /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
查看原来的iso参数信息
xorriso -indev ubuntu-22.04-desktop-amd64.iso -report_el_torito as_mkisofs
xorriso -as mkisofs -iso-level 3 -o ks_ubuntu2204.iso -full-iso9660-filenames -volid "ks Ubuntu 22.04 LTS" -boot-info-table --grub2-boot-info -eltorito-alt-boot -b 'boot/grub/i386-pc/eltorito.img' -boot-load-size 10068 --grub2-boot-info -boot-info-table -boot-load-size 4 -c '/boot.catalog' -iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 -appended_part_as_gpt --mbr-force-bootable -partition_offset 16 -partition_cyl_align off --protective-msdos-label -no-emul-boot -isohybrid-gpt-basdat livecd/
server版本
sudo mksquashfs squashfs-root livecd/casper/ubuntu-server-minimal.squashfs -comp xz -noappend

aptly同步阿里云镜像
sudo apt install aptly
aptly mirror create -architectures=amd64 -filter='Priority (required) | Priority (important) | Priority (standard)' -filter-with-deps aliubuntu2204 http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse

根据提示

gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C
aptly mirror update aliubuntu2204

可能存在gpg权限问题

chown -R $(whoami) ~/.gnupg
chmod -R 600 ~/.gnupg
chmod 700 ~/.gnupg

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一、Ubuntu简介   Ubuntu(友帮拓、优般图、乌班图)是一个以桌面应用为主的开源GNU/Linux操作系...
    无剑_君阅读 5,539评论 0 2
  • 一、安装注意事项 安装时选择英文版(否则后面会报错无法安装busybox等。 安装时软件包openssh一定要选上...
    风吹我已散博客阅读 5,278评论 0 0
  • 下载 Ubuntu 官网下载[https://ubuntu.com/download] 简介 Linux 是一种自...
    彭楷淳阅读 2,828评论 0 0
  • 安装好ubuntu双系统后,默认的软件更新源是国外的,在国内使用速度很慢,需要更换成国内的源,这样才能正常安装和更...
    AI秘籍阅读 137,025评论 3 9
  • 编辑/etc/apt/sources.list文件, 在文件最前面添加以下条目(操作前请做好相应备份): 清华源 ...
    44e46f384a16阅读 962评论 0 0