logo NodeSeekbeta

debian x86_64系统 kvm 切分小鸡教程

  1. 先确认系统支持kvm虚拟化,其中 VM-x/AMD-V 行是看是不是支持kvm虚拟化,如果不支持就不用继续了,如果支持,请继续下面的步骤
curl -sL yabs.sh | bash -s -- -dig
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2025-04-20                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #

Thu Dec  4 17:05:23 UTC 2025

Basic System Information:
---------------------------------
Uptime     : 6 days, 3 hours, 13 minutes
Processor  : AMD Ryzen 9 9950X 16-Core Processor
CPU cores  : 2 @ 4291.908 MHz
AES-NI     : ✔ Enabled
VM-x/AMD-V : ✔ Enabled
RAM        : 1.9 GiB
Swap       : 0.0 KiB
Disk       : 117.5 GiB
Distro     : Debian GNU/Linux 13 (trixie)
Kernel     : 6.12.57+deb13-amd64
VM Type    :
IPv4/IPv6  : ✔ Online / ✔ Online

IPv6 Network Information:
---------------------------------
ISP        : The Infrastructure Group B.V.
ASN        : AS60404 The Infrastructure Group B.V.
Host       : TIG
Location   : Dronten, Flevoland (FL)
Country    : The Netherlands

YABS completed in 0 sec
  1. 第2、3、4步可以简化成一条命令
apt install -y qemu-system-x86 qemu-utils cloud-utils
  1. 下载 qemu,到 https://www.qemu.org/download/ 选择一个版本下载,比如最新的 qemu-10.2.0-rc1

  2. 安装依赖

apt update && apt install -y git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev ninja-build libslirp-dev cloud-utils
  1. 安装 qemu
tar xvf qemu-10.2.0-rc1.tar.xz
cd qemu-10.2.0-rc1
mkdir -pv build
cd build
../configure --target-list=x86_64-softmmu && make -j2 && make install
  1. 配置cloud-init,要不然没有账户密码登陆
  • 创建user-data.yaml文件,内容如下
chpasswd:
  list: |
    root:password
  expire: False
ssh_pwauth: True
  • 生成种子镜像,执行下面的命令
cloud-localds seed.img user-data.yaml
  1. 到 https://cdimage.debian.org/images/cloud 下载系统镜像,比如下载 debian-13-generic-amd64-20251117-2299.qcow2
wget https://cdimage.debian.org/images/cloud/trixie/20251117-2299/debian-13-generic-amd64-20251117-2299.qcow2
  1. 调整系统盘大小,比如调整系统盘到10G大小
qemu-img resize debian-13-generic-amd64-20251117-2299.qcow2 20G
  1. 启动虚拟机,给虚拟机分配1C1G,-smp 是CPU核心数,-m 是内存大小(MB),hostfwd=tcp::8022-:22是把小鸡系统内的22端口映射到大鸡系统的8022端口
qemu-system-x86_64 -machine type=pc,accel=kvm -smp 1 -m 1024   -drive file=debian-13-generic-amd64-20251117-2299.qcow2,format=qcow2,cache=none,discard=unmap -cdrom seed.img  -enable-kvm   -net nic,model=virtio -net user,hostfwd=tcp::8022-:22   -cpu host   -nographic -serial mon:stdio
  1. 开机后可以直接在界面是使用第5步里配置的用户root密码password登陆,登陆完安装 openssh-server ,才可以用大鸡的在第8步配置的8022端口远程连接小鸡

大鸡也不必很大,看我的大鸡只有2C2G

大鸡示例

# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2025-04-20                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #

Fri Nov 28 14:10:28 UTC 2025

Basic System Information:
---------------------------------
Uptime     : 0 days, 0 hours, 18 minutes
Processor  : AMD Ryzen 9 9950X 16-Core Processor
CPU cores  : 2 @ 4291.908 MHz
AES-NI     : ✔ Enabled
VM-x/AMD-V : ✔ Enabled
RAM        : 1.9 GiB
Swap       : 0.0 KiB
Disk       : 117.5 GiB
Distro     : Debian GNU/Linux 13 (trixie)
Kernel     : 6.12.57+deb13-amd64
VM Type    :
IPv4/IPv6  : ✔ Online / ✔ Online

IPv6 Network Information:
---------------------------------
ISP        : The Infrastructure Group B.V.
ASN        : AS60404 The Infrastructure Group B.V.
Host       : TIG
Location   : Dronten, Flevoland (FL)
Country    : The Netherlands

fio Disk Speed Tests (Mixed R/W 50/50) (Partition /dev/vda2):
---------------------------------
Block Size | 4k            (IOPS) | 64k           (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 416.13 MB/s (104.0k) | 3.36 GB/s    (52.6k)
Write      | 417.22 MB/s (104.3k) | 3.38 GB/s    (52.9k)
Total      | 833.36 MB/s (208.3k) | 6.75 GB/s   (105.5k)
           |                      |
Block Size | 512k          (IOPS) | 1m            (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 5.13 GB/s    (10.0k) | 5.45 GB/s     (5.3k)
Write      | 5.40 GB/s    (10.5k) | 5.81 GB/s     (5.6k)
Total      | 10.53 GB/s   (20.5k) | 11.27 GB/s   (11.0k)

Geekbench 6 Benchmark Test:
---------------------------------
Test            | Value
                |
Single Core     | 3444
Multi Core      | 5972
Full Test       | https://browser.geekbench.com/v6/cpu/15279478

YABS completed in 4 min 58 sec

小鸡示例

# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2025-04-20                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #

Sat Nov 29 08:32:26 AM CST 2025

Basic System Information:
---------------------------------
Uptime     : 0 days, 0 hours, 9 minutes
Processor  : AMD Ryzen 9 9950X 16-Core Processor
CPU cores  : 1 @ 4291.908 MHz
AES-NI     : ✔ Enabled
VM-x/AMD-V : ✔ Enabled
RAM        : 945.5 MiB
Swap       : 1000.0 MiB
Disk       : 18.6 GiB
Distro     : Debian GNU/Linux 13 (trixie)
Kernel     : 6.12.57+deb13-amd64
VM Type    : KVM
IPv4/IPv6  : ✔ Online / ❌ Offline

IPv4 Network Information:
---------------------------------
ISP        : The Infrastructure Group B.V.
ASN        : AS60404 The Infrastructure Group B.V.
Host       : TIG
Location   : Dronten, Flevoland (FL)
Country    : The Netherlands

fio Disk Speed Tests (Mixed R/W 50/50) (Partition /dev/sda2):
---------------------------------
Block Size | 4k            (IOPS) | 64k           (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 282.45 MB/s  (70.6k) | 2.18 GB/s    (34.1k)
Write      | 283.19 MB/s  (70.7k) | 2.19 GB/s    (34.2k)
Total      | 565.65 MB/s (141.4k) | 4.37 GB/s    (68.4k)
           |                      |
Block Size | 512k          (IOPS) | 1m            (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 5.04 GB/s     (9.8k) | 5.41 GB/s     (5.2k)
Write      | 5.31 GB/s    (10.3k) | 5.77 GB/s     (5.6k)
Total      | 10.35 GB/s   (20.2k) | 11.18 GB/s   (10.9k)

Geekbench 6 Benchmark Test:
---------------------------------
Test            | Value
                |
Single Core     | 2487
Multi Core      | 1570
Full Test       | https://browser.geekbench.com/v6/cpu/15298912

YABS completed in 8 min 24 sec
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2025-04-20                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #

Sat Nov 29 09:19:29 AM CST 2025

Basic System Information:
---------------------------------
Uptime     : 0 days, 0 hours, 1 minutes
Processor  : AMD Ryzen 9 9950X 16-Core Processor
CPU cores  : 1 @ 4291.908 MHz
AES-NI     : ✔ Enabled
VM-x/AMD-V : ✔ Enabled
RAM        : 458.3 MiB
Swap       : 1000.0 MiB
Disk       : 18.6 GiB
Distro     : Debian GNU/Linux 13 (trixie)
Kernel     : 6.12.57+deb13-amd64
VM Type    : KVM
IPv4/IPv6  : ✔ Online / ❌ Offline

IPv4 Network Information:
---------------------------------
ISP        : The Infrastructure Group B.V.
ASN        : AS60404 The Infrastructure Group B.V.
Host       : TIG
Location   : Dronten, Flevoland (FL)
Country    : The Netherlands

fio Disk Speed Tests (Mixed R/W 50/50) (Partition /dev/sda2):
---------------------------------
Block Size | 4k            (IOPS) | 64k           (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 281.73 MB/s  (70.4k) | 2.04 GB/s    (32.0k)
Write      | 282.47 MB/s  (70.6k) | 2.05 GB/s    (32.1k)
Total      | 564.20 MB/s (141.0k) | 4.10 GB/s    (64.1k)
           |                      |
Block Size | 512k          (IOPS) | 1m            (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 5.32 GB/s    (10.3k) | 5.47 GB/s     (5.3k)
Write      | 5.60 GB/s    (10.9k) | 5.83 GB/s     (5.6k)
Total      | 10.92 GB/s   (21.3k) | 11.30 GB/s   (11.0k)

Geekbench 5 Benchmark Test:
---------------------------------
Test            | Value
                |
Single Core     | 2482
Multi Core      | 2466
Full Test       | https://browser.geekbench.com/v5/cpu/23937051

Geekbench test failed and low memory was detected. Add at least 1GB of SWAP or use GB4 instead (higher compatibility with low memory systems).

YABS completed in 10 min 26 sec
12
12

你好啊,陌生人!

我的朋友,看起来你是新来的,如果想参与到讨论中,点击下面的按钮!

📈用户数目📈

目前论坛共有72033位seeker

🎉欢迎新用户🎉