update 4.PVE制作虚拟机模板.md.

This commit is contained in:
秋刀狐狸
2022-08-05 08:43:18 +00:00
committed by Gitee
parent e7a76def14
commit 1a25528325
6 changed files with 67 additions and 1 deletions
+66
View File
@@ -77,3 +77,69 @@ CPU类别选择 `host` ,核心根据物理 CPU 核心数进行酌情设置,
接下来查看设置总览,确认无误,即可点击 “完成” : 接下来查看设置总览,确认无误,即可点击 “完成” :
![虚拟机确认](img/Template/vm_confirm.png) ![虚拟机确认](img/Template/vm_confirm.png)
## 2.调整虚拟机硬件参数
### 2.1.删除虚拟机光驱
此时,查看虚拟机详情页,可以看到我们刚才创建的 Debian 虚拟机,删除 `CD/DVD驱动器`
![虚拟机删除光驱](img/Template/vm_delete_cd.png)
### 2.2.虚拟机导入磁盘镜像
使用 SSH 工具登录 PVE 服务器,并进入 `tmp` 目录,创建一个文件夹:
```bash
# 进入 tmp 目录
cd /tmp
# 创建文件夹
mkdir Debian
# 进入文件夹
cd Debian
```
将 Debian 云镜像 `debian-11-genericcloud-amd64.qcow2` 上传到该文件夹中,并检查 `hash`
```bash
# 检查文件是否存在
ls -la
# 计算文件 hash
sha512sum debian-11-genericcloud-amd64.qcow2
```
确认无误后,将 Debian 云镜像导入刚才创建的虚拟机中,命令中的 `VM ID` 需要根据实际情况替换,演示为 `1000`
```bash
# 将 qcow2 镜像导入虚拟机中
qm importdisk 1000 debian-11-genericcloud-amd64.qcow2 local-lvm
# 输出结果为以下类似内容表示成功
Successfully imported disk as 'unused0:local-lvm:vm-1000-disk-1'
```
![虚拟机新磁盘](img/Template/vm_unused_hd.png)
鼠标 **双击** 该未使用的磁盘,勾选 `IO thread` ,点击添加按钮:
![虚拟机使用该磁盘](img/Template/vm_enable_hd.png)
刚导入的磁盘只有 `2G` 磁盘空间,为了后续方便使用,先给磁盘扩容 `16G` 的磁盘空间。
选择 `Disk Action` 菜单的子菜单 `Resize`
![虚拟机磁盘扩容](img/Template/vm_hd_resize.png)
在弹出的对话框中,给该磁盘增加 `16G` 的磁盘容量:
![虚拟机磁盘增加16G](img/Template/vm_hd_16g.png)
### 2.3.虚拟机添加CloudInit设备
Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB