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

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

文章目录

环境配置如下:

  • ubuntu22.04
  • virtualbox
  • windows10

1.安装virtualbox

运行下列命令安装virtualbox

bash 复制代码
sudo apt-get install virtualbox

等待安装完毕后,再菜单栏里找到virtualbox打开并启动

然后点击New

然后取名+选择安装系统的版本

然后分配内存大小,在绿色线范围内都是可以的

然后选择创建虚拟磁盘

选择磁盘类型为VDI

选择动态分配内存

设置磁盘内存大小

然后点击Create即可完成创建

2.下载Window.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.

首先,尝试使用

bash 复制代码
sudo modprobe vboxdrv

如果报错

bash 复制代码
$ sudo modprobe vboxdrv
modprobe: ERROR: could not insert 'vboxdrv': Required key not available

则使用以下的两条命令

bash 复制代码
sudo apt update
sudo apt install --reinstall linux-headers-$(uname -r) virtualbox-dkms dkms

使用完毕后,会让你输入一个MOK的密码,请记住这个密码,这里我的密码设置为test123456,然后rebot重启电脑,执行perform mok management,按照以下的步骤执行:

  • 选择enroll mok (perform mok mangement 界面)
  • 选择contninue(enroll mok 界面)
  • 选择yes(enroll the key 界面)
  • 输入安装时设定的密码,我的密码是test123456,所以我就输出test123456
  • 选择Rebot(perform mok management 界面)

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

bash 复制代码
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)

这个报错的意思是CPUVT-X虚拟化技术处于关闭状态,需要在电脑主板BIOS中开启CPU虚拟化技术,每种类型的主板操作不一样,但是大概的操作方式是:

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

4.安装Windows

我们成功启动进入安装界面,windows的版本选择windows10专业版

然后在安装的过程中选择自定义:仅安装Windows

其余步骤使用默认的选项就好。

这里安装的Windows是正版

5.其他配置

5.1配置自适应全屏

首先下载Guest Additions CD image

然后在我的桌面找到这个驱动器

然后运行这个安装程序,默认安装即可

然后重启虚拟机,在菜单选项栏中,使用view > Adjust Window Size即可调整屏幕的大小了

5.2设置共享文件夹

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

Reference

1ubuntu下用VirtualBox安装Windows虚拟机

2How can I fix this 'modprobe vboxdrv' error in VirtualBox? ERROR: could not insert 'vboxdrv': Required key not available

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

4How to fix errors in virtualbox - modprobe vboxdrv, Kernel driver not installed

相关推荐
orion5719 小时前
Missing Semester Class1:course overview and introduction of shell
linux
用户120487221611 天前
Linux驱动编译与加载
linux·嵌入式
用户805533698031 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698031 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房2 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia3 天前
linux curl命令详解_curl详解
linux
扛枪的书生3 天前
Linux 网络管理器用法速查
linux
顺风尿一寸3 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode3 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫3 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux