This commit is contained in:
colben 2025-02-14 16:45:14 +08:00
parent 8c085cdb9a
commit 8477fd5f7e

View File

@ -328,7 +328,7 @@ incus3 | eth0: 192.168.1.3 | 10.10.10.3 | /dev/sdb | 10.10.10.3 incus3
- 下载 RockyLinux8 操作系统镜像文件Rocky-8.10-x86_64-minimal.iso - 下载 RockyLinux8 操作系统镜像文件Rocky-8.10-x86_64-minimal.iso
- 创建 iso 存储卷 - 创建 iso 存储卷
```BASH ```BASH
sudo incus storage volume import pool1 \ incus storage volume import pool1 \
/root/Rocky-8.7-x86_64-minimal.iso \ /root/Rocky-8.7-x86_64-minimal.iso \
rocky8-iso-volume --type=iso rocky8-iso-volume --type=iso
# pool1: 存储池 # pool1: 存储池
@ -338,24 +338,24 @@ incus3 | eth0: 192.168.1.3 | 10.10.10.3 | /dev/sdb | 10.10.10.3 incus3
- 创建一个空的虚拟机,并设置 cpu、内存和系统盘大小和 boot 优先级 - 创建一个空的虚拟机,并设置 cpu、内存和系统盘大小和 boot 优先级
```BASH ```BASH
sudo incus create vm1 --empty --vm -c limits.cpu=2 -c limits.memory=4GiB -d root,size=6GiB -s pool1 incus create vm1 --empty --vm -c limits.cpu=2 -c limits.memory=4GiB -d root,size=6GiB -s pool1
# vm1虚拟机名字 # vm1虚拟机名字
# limits.cpu=2虚拟机占用 2 核 # limits.cpu=2虚拟机占用 2 核
# limits.memory虚拟机占用 4G 内存 # limits.memory虚拟机占用 4G 内存
# root,size=6GiB虚拟机中的系统盘设备名是 root大小是 6G # root,size=6GiB虚拟机中的系统盘设备名是 root大小是 6G
# pool1: 存储池 # pool1: 存储池
sudo incus config device set vm1 root boot.priority=20 incus config device set vm1 root boot.priority=20
# boot.priority=20boot 优先级,数字越大,优先级越高 # boot.priority=20boot 优先级,数字越大,优先级越高
# 修改虚拟机配置 # 修改虚拟机配置
#sudo incus config set vm1 limits.cpu=4 #incus config set vm1 limits.cpu=4
#sudo incus config edit vm1 #incus config edit vm1
``` ```
- 为虚拟机增加 iso 存储卷,并设置 boot 优先级 - 为虚拟机增加 iso 存储卷,并设置 boot 优先级
```BASH ```BASH
sudo incus config device add vm1 iso-cd disk \ incus config device add vm1 iso-cd disk \
pool=pool1 source=rocky8-iso-volume boot.priority=10 pool=pool1 source=rocky8-iso-volume boot.priority=10
# vm1虚拟机名字 # vm1虚拟机名字
# iso-cd虚拟机中的 iso 只读盘设备名 # iso-cd虚拟机中的 iso 只读盘设备名
@ -366,17 +366,17 @@ incus3 | eth0: 192.168.1.3 | 10.10.10.3 | /dev/sdb | 10.10.10.3 incus3
- 启动虚拟机 - 启动虚拟机
```BASH ```BASH
sudo incus start vm1 incus start vm1
``` ```
- 打开已运行虚拟机的 console 终端,此时会在 debian gnome 桌面中自动打开 remove-viewer - 打开已运行虚拟机的 console 终端,此时会在 debian gnome 桌面中自动打开 remove-viewer
```BASH ```BASH
sudo incus console vm1 --type=vga incus console vm1 --type=vga
``` ```
- 在 remote-viewer 窗口中开始安装 RockyLinux8 - 在 remote-viewer 窗口中开始安装 RockyLinux8
- 系统安装完成后,虚拟机不再需要 iso 只读盘设备,可以卸载 - 系统安装完成后,虚拟机不再需要 iso 只读盘设备,可以卸载
```BASH ```BASH
sudo incus config device remove vm1 iso-cd incus config device remove vm1 iso-cd
``` ```