ubuntu系统定制(2204)

2023-11-30  本文已影响0人  DifferentMan

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

上一篇下一篇

猜你喜欢

热点阅读