Ubuntu20.04如何安装虚拟机(并安装Android)

安装虚拟机(KVM)

这种KVM只能安装windows无法安装安卓

(From https://phoenixnap.com/kb/ubuntu-install-kvm)

A type 2 hypervisor enables users to run isolated instances of other operating systems inside a host system. As a Linux based OS, Ubuntu supports a wide range of virtualization solutions.

Aside from popular third-party apps, such as VirtualBox and VMWare, the Linux kernel has its own virtualization module called KVM (Kernel-based Virtual Machine).

In this tutorial you will learn how to install and set up KVM on Ubuntu 20.04.

Prerequisites

  • A system running Ubuntu 20.04

  • An account with sudo privileges

  • Access to the command line/terminal

Check Virtualization Support on Ubuntu 20.04

1. Before you begin with installing KVM, check if your CPU supports hardware virtualization via egrep command:

egrep -c '(vmx|svm)' /proc/cpuinfo

Check the number in the output:

If the command returns a value of 0, your processor is not capable of running KVM. On the other hand, any other number means you can proceed with the installation.

2. Now, check if your system can use KVM acceleration by typing:

sudo kvm-ok

The output should look like this:

If kvm-ok returns an error stating KVM acceleration cannot be used, try solving the problem by installing cpu-checker.

3. To install cpu-checker, run the following command:

sudo apt install cpu-checker

4. When the installation completes, restart the terminal.

You are now ready to start installing KVM.


Note: When it is performed for servers, hardware virtualization is referred to as server virtualization.


Install KVM on Ubuntu 20.04

To enable KVM virtualization on Ubuntu 20.04:

  • Authorize users to run VMs

  • Verify that the installation was successful

Step 1: Install KVM Packages

1. First, update the repositories:

sudo apt update

2. Then, install essential KVM packages with the following command:

sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils

This will start the installation of four KVM packages:

3. When prompted, type Y, press ENTER, and wait for the installation to finish.

Step 2: Authorize Users

1. Only members of the libvirt and kvm user groups can run virtual machines. Add a user to the libvirt group by typing:

sudo adduser ‘username’ libvirt

Replace username with the actual username.

2. Now do the same for the kvm group:

sudo adduser ‘[username]’ kvm

Note: If you need to remove a user from the libvirt or kvm group, just replace adduser with deluser in the command above.


Step 3: Verify the Installation

1. Confirm the installation was successful by using the virsh command:

virsh list --all

You can expect an output as seen below:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值