centos

CentOS#

  • 下载
  • kernel-core - 安装后 70MB
    • 包含内核,依赖 linux-firmware
      • linux-firmware 安装后 350MB
yum module list virt

rootfs#

# rootfs - 这个 rootfs 是用于 docker 的
curl -LOC- https://github.com/CentOS/sig-cloud-instance-images/raw/CentOS-8-x86_64/docker/centos-8-x86_64.tar.xz
qemu-img create -f raw centos.rootfs.ext4 1G
mkfs.ext4 centos.rootfs.ext4
mkdir -p /tmp/rootfs
sudo mount centos.rootfs.ext4 /tmp/rootfs
sudo tar xvf centos-8-x86_64.tar.xz -C /tmp/rootfs/
sudo cp /etc/resolv.conf /tmp/rootfs/etc/resolv.conf
sudo chroot /tmp/rootfs /bin/bash
yum update -y
# 获取到 kernel
yum install -y yum-utils
rpm -Uvh --nodeps $(repoquery --location kernel-core)
exit

install#

curl -OC- http://mirrors.aliyun.com/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-minimal.iso
qemu-img create -f qcow2 centos.qcow2 10G
qemu-system-x86_64 -accel kvm -m 4G -smp 2 -net nic -nic user,hostfwd=tcp::2222-:22 -drive file=centos.qcow2,if=virtio -serial stdio -vnc :10

kernel#