制作Centos7.9 Live系统镜像

live-build 配置脚本

bash 复制代码
#!/bin/sh

# CentOS 7.9 系统的 live-build 配置脚本

set -e

echo "I: create configuration"
export LB_BOOTSTRAP_INCLUDE="yum-utils"
lb config \
 --mirror-bootstrap "https://vault.centos.org/centos/7.9.2009/os/x86_64/" \
 --mirror-chroot "https://vault.centos.org/centos/7.9.2009/os/x86_64/" \
 --mirror-chroot-security "https://vault.centos.org/centos/7.9.2009/updates/x86_64/" \
 --mirror-binary "https://vault.centos.org/centos/7.9.2009/os/x86_64/" \
 --mirror-binary-security "https://vault.centos.org/centos/7.9.2009/updates/x86_64/" \
 --apt-indices false \
 --apt-recommends false \
 --apt-secure false \
 --architectures x86_64 \
 --archive-areas 'main contrib non-free' \
 --backports false \
 --binary-filesystem ext4 \
 --binary-images tar \
 --bootappend-live "hostname=centos username=flexmi" \
 --bootstrap-qemu-arch x86_64 \
 --bootstrap-qemu-static /usr/bin/qemu-x86_64-static \
 --cache false \
 --chroot-filesystem none \
 --compression gzip \
 --distribution centos7 \
 --gzip-options '-9 --rsyncable' \
 --iso-publisher 'Your Name; http://www.yourwebsite.com/; your-email@example.com' \
 --iso-volume 'CentOS 7.9 $(date +%Y%m%d-%H:%M)' \
 --linux-flavours none \
 --linux-packages none \
 --mode centos \
 --security true \
 --system normal \
 --updates true

安装必要工具

确保你已经安装了 livecd-toolscreaterepo

bash 复制代码
sudo yum install livecd-tools createrepo

Live系统编译脚本

bash 复制代码
# CentOS 7.9 Live CD Build Makefile

BUILD_NUMBER?=1
BASEIMG=centos7.9
IMAGEPREFIX=$(BASEIMG)-date +%Y%m%d-$(BUILD_NUMBER)
LOGFILE=$(IMAGEPREFIX).build-log.txt
CONFIGFILE=$(IMAGEPREFIX).ks.cfg
ISOFILE=$(IMAGEPREFIX).iso
MD5SUMSFILE=$(IMAGEPREFIX).md5sums.txt
SHA1SUMSFILE=$(IMAGEPREFIX).sha1sums.txt

all:
	set -e; \
	sudo livecd-creator --config=ks.cfg --fslabel=$(IMAGEPREFIX) 2>&1 | tee $(LOGFILE); \
	if [ -f $(ISOFILE) ]; then \
		md5sum $(LOGFILE) $(CONFIGFILE) $(ISOFILE) > $(MD5SUMSFILE); \
		sha1sum $(LOGFILE) $(CONFIGFILE) $(ISOFILE) > $(SHA1SUMSFILE); \
	fi

clean:
	rm -f $(BASEIMG)-*
	rm -rf config
相关推荐
闭关苦炼内功3 个月前
docker 容器 network host 模式启动
linux·运维·docker·容器·shell·centos7.9
羌俊恩1 年前
Centos 6.5 升级到Centos7指导手册
python·跨大版本升级·centos6.5·libsasl.so.0·centos7.9