问小白 wenxiaobai
资讯
历史
科技
环境与自然
成长
游戏
财经
文学与艺术
美食
健康
家居
文化
情感
汽车
三农
军事
旅行
运动
教育
生活
星座命理

Ubuntu 22.04 配置VirtualBox安装Windows 10虚拟机

创作时间:
作者:
@小白创作中心

Ubuntu 22.04 配置VirtualBox安装Windows 10虚拟机

引用
CSDN
1.
https://blog.csdn.net/qq_44940689/article/details/137860265

本文将详细介绍如何在Ubuntu 22.04系统上使用VirtualBox安装Windows 10虚拟机。从VirtualBox的安装到Windows的配置,以及解决常见问题,手把手教你完成整个过程。

环境配置如下:

  • Ubuntu 22.04
  • VirtualBox
  • Windows 10

1. 安装VirtualBox

运行以下命令进行安装:

sudo apt-get install virtualbox

等待安装完毕后,在菜单栏里找到VirtualBox并打开。点击"New"按钮,然后输入虚拟机名称并选择安装系统的版本。分配内存大小时,建议在绿色线范围内选择。

然后选择创建虚拟磁盘,建议选择VDI格式,并选择动态分配内存。设置磁盘内存大小后,点击"Create"完成创建。

2. 下载Windows ISO文件并载入

你可以从Windows官网下载ISO文件。假设你已经下载好了ISO文件,接下来进行配置。选中你所下载的ISO文件,然后进行启动。

3. 常见问题解决

3.1 Kernel driver not installed (rc=-1908)

如果遇到以下错误:

Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please install virtualbox-dkms package and load the kernel module by executing
modprobe vboxdrv
as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.
where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT.

首先尝试使用以下命令:

sudo modprobe vboxdrv

如果报错:

$ sudo modprobe vboxdrv
modprobe: ERROR: could not insert 'vboxdrv': Required key not available

则使用以下命令:

sudo apt update
sudo apt install --reinstall linux-headers-$(uname -r) virtualbox-dkms dkms

使用完毕后,会让你输入一个MOK密码,请记住这个密码。重启电脑,执行perform mok management,按照以下步骤操作:

  • 选择enroll mok(perform mok mangement 界面)
  • 选择continue(enroll mok 界面)
  • 选择yes(enroll the key 界面)
  • 输入安装时设定的密码
  • 选择Rebot(perform mok management 界面)

重新启动完毕后,在终端输入:

sudo modprobe vboxdrv

如果没有报错,说明问题已解决。

3.2 VT-x is disabled in the BIOS for all CPU modes

如果遇到以下错误:

VT-x is disabled in the BIOS for both all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)

这表示CPU的VT-X虚拟化技术处于关闭状态,需要在电脑主板BIOS中开启CPU虚拟化技术。具体操作步骤如下:

  • 重启进入BIOS
  • 找到CPU相关的Visualization相关选项
  • 设置为ON,允许虚拟化

4. 安装Windows

成功启动进入安装界面后,选择Windows 10专业版。在安装过程中选择"自定义:仅安装Windows",其余步骤使用默认选项即可。

5. 其他配置

5.1 配置自适应全屏

首先下载Guest Additions CD image。在我的桌面找到这个驱动器,然后运行这个安装程序,默认安装即可。重启虚拟机后,在菜单选项栏中使用"View > Adjust Window Size"即可调整屏幕大小。

5.2 设置共享文件夹

在虚拟机的设置中添加共享文件夹,并选择你需要共享的文件夹即可。

参考资料

[1] ubuntu下用VirtualBox安装Windows虚拟机
[2] How can I fix this ‘modprobe vboxdrv’ error in VirtualBox? ERROR: could not insert ‘vboxdrv’: Required key not available
[3] VT-x is disabled in the BIOS for both all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)
[4] How to fix errors in virtualbox - modprobe vboxdrv, Kernel driver not installed

© 2023 北京元石科技有限公司 ◎ 京公网安备 11010802042949号