Ubuntu虚拟机使用Debos构建Debian10
Ubuntu虚拟机版本:19.04Golang版本: 1.13.4 linux/amd64步骤:1.安装必要软件:sudo apt install golang git libglib2.0-dev libostree-dev qemu-system-x86 \build-essential qemu-user-static debootstrap sys...
·
Ubuntu虚拟机版本:19.04
Golang版本: 1.13.4 linux/amd64
Debos工程:
Debos是一个使用GO开发的相对简单的debian文件系统构建工具,提供了以下的命令:
Some of the actions provided by debos to customize and produce images are:
- apt: install packages and their dependencies with 'apt'
- debootstrap: construct the target rootfs with debootstrap
- download: download a single file from the internet
- filesystem-deploy: deploy a root filesystem to an image previously created
- image-partition: create an image file, make partitions and format them
- ostree-commit: create an OSTree commit from rootfs
- ostree-deploy: deploy an OSTree branch to the image
- overlay: do a recursive copy of directories or files to the target filesystem
- pack: create a tarball with the target filesystem
- raw: directly write a file to the output image at a given offset
- recipe: includes the recipe actions at the given path
- run: allows to run a command or script in the filesystem or in the host
- unpack: unpack files from archive in the filesystem
步骤:
1.安装必要软件:
sudo apt install golang git libglib2.0-dev libostree-dev qemu-system-x86 \
build-essential qemu-user-static debootstrap systemd-container \
binfmt-support policykit-1 parted dosfstools xz-utils bmap-tools
2.设置环境:
sudo systemctl start systemd-resolved
export GOPATH=`pwd`/gocode
go get -u github.com/go-debos/debos/cmd/debos
3.根据配置文件构建:
sudo debos debian.yaml #假设你的配置文件为 debian.yaml
若构建过程出现错误提示如下:
chroot: failed to run command '/debootstrap/debootstrap': Exec format error
则:
sudo apt-get remove qemu-user-static #卸载
sudo apt-get install qemu-user-static #重装
sudo update-binfmts --enable #构建之前运行
说明:
qemu-user-static服务为程序运行构建虚拟环境,比如在你电脑上模拟ARM运行环境;
update-binfmts服务为文件指定特定程序运行,类似Windws根据文件后缀指定运行程序;
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献1条内容
所有评论(0)