diff --git a/content/post/incus-install.md b/content/post/incus-install.md index a865c42..250c0e8 100644 --- a/content/post/incus-install.md +++ b/content/post/incus-install.md @@ -8,9 +8,9 @@ categories: ["kvm", "container"] ## 单机环境 ### 服务器 -处理器 | 内存 | 系统盘 | 数据盘 | 操作系统 ----- | ---- | ---- | ---- | ---- -4核 | 8GB | 30GB | 30GB | Rocky9 +处理器 | 内存 | 系统盘 | 数据盘 +---- | ---- | ---- | ---- +4核 | 8GB | 30GB | 30GB ### 操作系统配置 - 在 /etc/security/limits.conf 中追加如下配置 @@ -36,10 +36,13 @@ categories: ["kvm", "container"] - 安装 chrony,配置时间同步 -#### debian 系 linux -- 无需其他操作 +#### debian +- 安装 curl 和 gpg + ```BASH + apt install curl gpg + ``` -#### redhat 系 linux +#### centos/rocky/fedora - 禁用 selinux - 关闭并禁用防火墙(firewalld) - 安装 epel @@ -57,19 +60,52 @@ categories: ["kvm", "container"] - 重启操作系统 ### 安装 incus 环境 -#### debian 系 linux -- 安装 qemu-system 和 incus 包 +#### debian +- 参考[zabbly/incus](https://github.com/zabbly/incus) +- 引入公钥,用于验证软件包的完整性 ```BASH - apt install qemu-system-x86 incus + curl -fsSL https://pkgs.zabbly.com/key.asc | gpg --show-keys --fingerprint + mkdir -p /etc/apt/keyrings/ + curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc ``` -#### redhat 系 linux -- 安装 incus 包,**目前测试了红帽8及其更高版本的衍生 linux 都无法启动 kvm 虚拟机** +- 配置软件源,lts 版本太旧了,这里用的最新稳定版 + ```BASH + sh -c 'cat < /etc/apt/sources.list.d/zabbly-incus-stable.sources + Enabled: yes + Types: deb + URIs: https://pkgs.zabbly.com/incus/stable + Suites: $(. /etc/os-release && echo ${VERSION_CODENAME}) + Components: main + Architectures: $(dpkg --print-architecture) + Signed-By: /etc/apt/keyrings/zabbly.asc + + EOF' + ``` + +- 安装 incus 包 + ```BASH + apt update + apt install incus qemu-system + ``` + +- 配置 incus + ```BASH + echo 'INCUS_EDK2_PATH=/usr/share/ovmf' >> /etc/default/incus + ``` + +- 重启 incus + ```BASH + systemctl restart incus + ``` + +#### centos/rocky +- 安装 incus 包,**目前测试无法启动 kvm 虚拟机** ```BASH dnf -y copr enable ligenix/enterprise-qemu-wider dnf install lvm2 incus incus-tools # 打算尝试虚拟机的可以安装 qemu-system 包 - #dnf install qemu-system-x86 + #dnf install qemu-system ``` - 修改 incus 服务文件 @@ -83,6 +119,12 @@ categories: ["kvm", "container"] systemctl start incus ``` +#### fedora +- 安装 incus 包 + ```BASH + dnf install lvm2 incus incus-tools qemu-system + ``` + ### 初始化 incus 单机环境 - 初始化 incus ```BASH @@ -340,6 +382,11 @@ incus3 | eth0: 192.168.1.3 | 10.10.10.3 | /dev/sdb | 10.10.10.3 incus3 # boot.priority=10:boot 优先级,数字越大,优先级越高 ``` +- **在 aarch64 架构中,关闭虚拟机的安全启动** + ```BASH + incus config set vm1 security.secureboot=false + ``` + - 启动虚拟机 ```BASH incus start vm1