This commit is contained in:
colben
2025-02-28 18:19:24 +08:00
parent f57e34d2aa
commit 617cbf506f
2 changed files with 50 additions and 50 deletions

View File

@@ -37,25 +37,7 @@ categories: ["kvm", "container"]
- 安装 chrony配置时间同步
#### debian 系 linux
- (推荐)安装 gnome 和 virt-manager用来运行虚拟机桌面
```BASH
apt install gdm3 virt-manager gnome-terminal
```
- 创建普通用户 user1加入 sudo
```BASH
useradd -m user1
passwd user1
echo 'user1 ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/boya
```
- 修改 gdm3 配置文件 /etc/gdm3/daemon.conf配置用户自动登录
```
AutomaticLoginEnable = true
AutomaticLogin = user1
```
- 重启操作系统,进入桌面环境下,自动登录 user1 用户
- 无需其他操作
#### redhat 系 linux
- 禁用 selinux
@@ -76,19 +58,9 @@ categories: ["kvm", "container"]
### 安装 incus 环境
#### debian 系 linux
- 安装 qemu-system 包
- 安装 qemu-system 和 incus
```BASH
apt install qemu-system-x86
```
- 安装 nicus 包
```BASH
apt install incus
```
- 把 user1 用户加入 incus-admin 组
```BASH
usermod -a -G incus-admin user1
apt install qemu-system-x86 incus
```
#### redhat 系 linux
@@ -324,7 +296,8 @@ incus3 | eth0: 192.168.1.3 | 10.10.10.3 | /dev/sdb | 10.10.10.3 incus3
```
### qemu 虚拟机
- 登录已安装 incus 的 debian 操作系统的普通用户user1
- 客户机安装 [virt-viewer](https://releases.pagure.org/virt-viewer/virt-viewer-x64-11.0-1.0.msi)
- 登录已安装 incus 的 debian 操作系统下
- 下载 RockyLinux8 操作系统镜像文件Rocky-8.10-x86_64-minimal.iso
- 创建 iso 存储卷
```BASH
@@ -369,12 +342,22 @@ incus3 | eth0: 192.168.1.3 | 10.10.10.3 | /dev/sdb | 10.10.10.3 incus3
incus start vm1
```
- 打开已运行虚拟机的 console 终端,此时会在 debian gnome 桌面中自动打开 remove-viewer
- 打开已运行虚拟机的 console 终端
```BASH
incus console vm1 --type=vga
# 服务器中未安装 remote-viewer因此该命令会输出下面 spice socket 信息:
The client automatically uses either spicy or remote-viewer when present.
As neither could be found, the raw SPICE socket can be found at:
spice+unix:///root/.config/incus/sockets/xxxx.spice
```
- 在 remote-viewer 窗口中开始安装 RockyLinux8
- 用 ssh 把 socket 文件转成 tcp 端口,[/etc/sshd_config 配置参考这里](/post/ssh)
```BASH
ssh -N -g -L 5555:/root/.config/incus/sockets/xxxx.spice 127.0.0.1
```
- 在客户机中打开 virt-viewer输入地址“spice://{debian 服务器 ip}:5555”连接
- 在打开的窗口中开始安装 RockyLinux8
- 系统安装完成后,虚拟机不再需要 iso 只读盘设备,可以卸载
```BASH
incus config device remove vm1 iso-cd