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

news2024/11/14 21:28:35

安装虚拟机(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:

  • Install related packages using apt

  • 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:

2. Or use the systemctl command to check the status of libvirtd:

sudo systemctl status libvirtd

If everything is functioning properly, the output returns an active (running) status.

3. Press Q to quit the status screen.

4. If the virtualization daemon is not active, activate it with the following command:

sudo systemctl enable --now libvirtd

Creating a Virtual Machine on Ubuntu 20.04

1. Before you choose one of the two methods listed below, install virt-manager, a tool for creating and managing VMs:

sudo apt install virt-manager

2. Type Y and press ENTER. Wait for the installation to finish.

Make sure you download an ISO containing the OS you wish to install on a VM and proceed to pick an installation method.

Method 1: Virt Manager GUI

1. Start virt-manager with:

sudo virt-manager

2. In the first window, click the computer icon in the upper-left corner.

3. In the dialogue box that opens, select the option to install the VM using an ISO image. Then click Forward.

4. In the next dialogue, click Browse Local and navigate to the path where you stored the ISO you wish to install.

5. The ISO you chose in the previous window populates the field in Step 2. Proceed to Step 3 by clicking Forward.

6. Enter the amount of RAM and the number of CPUs you wish to allocate to the VM and proceed to the next step.

7. Allocate hard disk space to the VM. Click Forward to go to the last step.

8. Specify the name for your VM and click Finish to complete the setup.

9. The VM starts automatically, prompting you to start installing the OS that’s on the ISO file.

Method 2: Using Command Line

Use the virt-install command to create a VM via Linux terminal. The syntax is:

virt-install --option1=value --option2=value ...

In the following example, virt-install is used to install Fedora 33 Workstation.


Tip: For tidier appearance of commands with many options, type a back-slash after each option. That way, when you press Enter, the command will not execute, and the cursor will go to the next line.


Options behind the command serve to define the parameters of the installation.

Here is what each of them means:

Option

Description

--name

The name you give to the VM

--description

A short description of the VM

--ram

The amount of RAM you wish to allocate to the VM

--vcpus

The number of virtual CPUs you wish to allocate to the VM

--disk

The location of the VM on your disk (if you specify a qcow2 disk file that does not exist, it will be automatically created)

--cdrom

The location of the ISO file you downloaded

--graphics

Specifies the display type

Conclusion

After reading this article, you should know how to install KVM on Ubuntu 20.04. Additionally, the article describes two methods of setting up virtual machines, using the virt-manager GUI and the virt-install command.

安装虚拟机(VirtualBox)

(From https://beebom.com/run-android-on-linux-using-virtual-machine/)

Recently, we curated a list of top Android emulators for Linux systems and were disappointed to find that there is no proper application that can mimic Android on a Linux distro. That said, we did find a cool way to run Android on Linux using a virtual machine with Play Store support. And in fact, it works better than emulators due to better binary translation and desktop-like features. So in this article, we are going to show you how to run Android on Linux using a virtual machine. On that note, let’s go ahead and learn about the steps without any delay.

Run Android on Linux Using Virtual Machine

Before we go ahead, let me briefly explain how we are going to run Android on Linux. We are going to use an open-source project called Android-x86 that ports ARM-based Android OS to x86 based systems. Basically, with Android-x86’s ISO image, you can boot Android on any desktop platform, be it Windows or Linux.

You can also install and run the best of Android games and apps on your Linux machine. So here are the instructions that you have to go through to install Android on Linux as a virtual machine. You can click on the link below to seamlessly move between various sections.

Table Of Contents

Basic Setup

1. First of all, download the ISO image of Android 9 from here. Depending on your computer architecture, choose either a 64-bit or 32-bit ISO image. By the way, currently, Android 9 is the latest OS ported for desktop computers.

2. Once you have downloaded the Android ISO image, go ahead and download VirtualBox. You can find the setup file for all Linux distributions from here. After the download is complete, install VirtualBox on your system.

3. Here, I am running VirtualBox on Ubuntu. Now, click on “New” on the menubar and give a name to your virtual machine. For example, I have entered “Android”. Further, select the Type as “Linux” and choose “Other Linux (64-bit)” under Version. If you have a 32-bit machine then select “Other Linux (32-bit)”. Finally, click on “Next”.

4. On the next window, allot at least 2GB of RAM. If you have extra RAM available, increase it to 4GB for better performance while using Android.

5. Next, select “Create a virtual hard disk now” and click on “Create”.

6. Further, select “VDI” and click on “Next”.

7. Select “Dynamically allocated” and click on “Next”.

8. Here, enter the amount of storage that you want to allot to Android. The default is 8GB, but you can increase the storage to 16GB or more depending on your usage. Finally, click on “Create”.

Configure the Android Virtual Machine on Linux

1. Now that you have created the VM, it’s time to configure a few things so that you get the best performance while running Android on Linux. On the VirtualBox, click on “System“.

2. Move to the “Processor” tab and allot at least 2 CPU cores. You can also increase it to 4 for better gaming performance.

3. Next, switch to the “Acceleration” tab and choose “KVM” from the drop-down menu.

4. Once you have done that, move to the “Display” section and change the “Graphics controller” to “VBoxSVGA“. This is the most important step otherwise you will be stuck on a blank screen. Besides that, increase the Video Memory to at least 64-128MB.

5. Finally, go to “Storage” and select the “Empty” sub-menu. Here, click on the disc icon and select “Choose a disk file”.

6. Now, select the Android ISO image that you downloaded in the first step. You are basically done. Simply, click on the “OK” button.

Boot Android within Linux

1. After the basic setup and configuration, you are now ready to boot Android on Linux. Simply, select “Android” on the left pane and then click on “Start“.

2. Here, move to the “Advanced options“.

3. Now, select “Auto_Installation…” and hit enter.

4. On the next screen, select “Yes” and hit enter.

5. Finally, you will get the option to “Run Android-x86” on your Linux machine. Press enter and Android will starting booting on your Linux machine then and there.

6. You can go through the initial setup screen just like Android smartphones.

7. Finally, there you have it. Android 9 running on Linux with near-native performance. How great is that? Now onwards, you just need to press the “Start” button in VirtualBox and Android will be ready for you.

9. In case, you want to delete Android from Linux then simply right-click on the Android VM that you have created and choose “Remove”.

10. Next, click on “Delete all files”. It will remove the virtual hard drive and all associated files freeing up all the space on your computer. That’s it.

Install Android VM on Linux and Enjoy Android Games and Apps

So that is how you can install and run Android on Linux without using an emulator. One of the added benefits of this setup is that it makes things possible that you cannot do on your Android smartphone like taking screenshots on Snapchat without notifying sender, screen recording of protected content, playing games like PUBG, and much more.

You can even use Android as a desktop with the Taskbar launcher that ships with Android-x86 ISO image. Anyway, that is all from us. If you are facing any issue then do comment down below and let us know. We will surely try to help you out.

Solve network issue

(From https://askubuntu.com/questions/363003/no-internet-connection-on-virtualbox-windows-7-as-guest-ubuntu-13-04-as-host)

125

I was having the same problem on Ubuntu 12.10 64bit using Virtualbox 4.2.22. Here are the steps I took to solve my problem:

  1. Open Virtualbox Manager

  1. Select the machine you cannot get internet on in the left pane

  1. Click the Settings button in the top menu

  1. Click Network in the left pane in the settings window

  1. Switched to Bridged Adapter in the Attached to drop-down menu

  1. Select the name of the network adapter you are currently using on your host machine. I am using wireless so I chose eth0 which is my wireless network adapter. You can check which adapter you are currently using by opening the terminal (CTRL+ALT+T by default) and running ifconfig. It will probably be the eth adapter that shows an inet addr and shows data transfer next to RX bytes.

  1. Under Advanced, make sure the machine is using the Desktop Adapter Type

  1. Under Advanced, make sure Promiscuous Mode is set to Allow All

  1. Under Advanced, make sure Cable connected is checked on

  1. Hit OK to save your changes

  1. Start your VM

At that point you should be able to start a web browser in your VM and get a connection. This video provided the information I listed above, even though they are using a Windows 7 host with a Windows Server guest.

This is an image showing an example of the settings you need (taken from this answer).

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/356622.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Redis第四讲

目录 四、Redis04 4.1 Redis集群应用场景 4.2 集群 4.2.1 基本原理 4.2.2 主从复制的作用 4.3 配置集群(一台虚拟机) 4.3.1 规划网络 4.3.2 创建节点 4.3.3 创建目录 4.3.4 配置redis7001.conf 4.3.5 配置其余文件 4.3.6 后台启动redis 4.3…

【NLP实战】NLTK工具包

“Natural Language Toolkit,自然语言处理工具包,在NLP领域中,最常使用的一个Python库。NLTK是一个开源的项目,包含:Python模块,数据集和教程,用于NLP的研究和开发。NLTK由Steven Bird和Edward …

「可信计算」助力TLS 传输更安全

序言背景(Satuation):TLS 是 TCP/IP 上的传输层安全协议,保护着数以亿万级的数据安全,我们在浏览器中输入的 https,就是受到 TLS 保护的。冲突(complication):从可信计算…

洛谷P8601[蓝桥杯][2013年第四届真题]剪格子

题目描述如图 11 所示,33 的格子中填写了一些整数。我们沿着图中的红色线剪开,得到两个部分,每个部分的数字和都是 6060。本题的要求就是请你编程判定:对给定的 m\times nmn 的格子中的整数,是否可以分割为两个部分&am…

【Java开发】Spring 12 :Spring IOC控制反转和依赖注入(解决单接口多实现类调用)

IOC 是 Inversion of Control 的简写,译为“控制反转”,Spring 通过 IOC 容器来管理所有 Java 对象的实例化和初始化,控制对象与对象之间的依赖关系。我们将由 IOC 容器管理的 Java 对象称为 Spring Bean,它与使用关键字 new 创建…

分享112个HTML艺术时尚模板,总有一款适合您

分享112个HTML艺术时尚模板,总有一款适合您 112个HTML艺术时尚模板下载链接:https://pan.baidu.com/s/1D3-mfPOud-f3vy9yLl-bmw?pwdfph2 提取码:fph2 Python采集代码下载链接:采集代码.zip - 蓝奏云 时尚平面模特网站模板 潮…

Redis数据类型以及应用场景

目录1、 String(字符串)2、 Hash(哈希)3、 List(列表)4、 Set(集合)5、 sorted set(有序集合ZSet)字符串(String)、哈希表&#xff08…

40/365 javascript 严格检查模式 字符串

1.严格检查模式 因为js语法的随意性&#xff0c;可以直接使用变量&#xff08;没有声明&#xff09;&#xff0c;也不会报错。 <script>n 5;</script> 但这样会造成很多问题&#xff0c;一是变量不声明就使用&#xff0c;二是这样使用的变量会是全局变量&#x…

Python数据容器、list列表、tuple元组、str字符串、数据容器(序列)切片、set集合、dict字典

数据来源 01 数据容器 为什么学习数据容器 数据容器 总结 02 列表 1&#xff09;列表定义 为什么需要列表 列表的定义语法 列表的定义方式 演示 """ 演示数据容器之:list列表 语法:[元素,元素,......] """ # 定义一个列表list my_list …

从零开始 verilog 以太网交换机(三)MAC发送控制器的设计与实现

从零开始 verilog 以太网交换机&#xff08;三&#xff09;MAC发送控制器的设计与实现 &#x1f508;声明&#xff1a; &#x1f603;博主主页&#xff1a;王_嘻嘻的CSDN主页 &#x1f9e8; 从零开始 verilog 以太网交换机系列专栏&#xff1a;点击这里 &#x1f511;未经作者允…

数据结构概述

逻辑结构 顺序存储 随机访问是可以通过下标取到任意一个元素&#xff0c;即数组的起始位置下标 链式存储 链式存储是不连续的&#xff0c;比如A只保留了当前的指针&#xff0c;那么怎么访问到B和C呢 每个元素不仅存储自己的值还使用额外的空间存储指针指向下一个元素的地址&a…

【python】英雄联盟电竞观赛引擎 掉落提示 CapsuleFarmerEvolved 「Webhook」「钉钉」

介绍 本项目链接 Github本项目链接 Gitee本项目链接 最近在github上发现一个可以用来自动帮你挂英雄联盟(除国服)电竞引擎(可以开出头像和表情)的项目,CapsuleFarmerEvolved,github原项目链接简单来说就是本来是通过看比赛获取奖励的,它帮助你进行观看. 对这个活动有兴趣的话…

3|物联网控制|计算机控制-刘川来胡乃平版|第1章:绪论|青岛科技大学课堂笔记|U1 ppt

目录绪论&#xff08;2学时&#xff09;常用仪表设备&#xff08;3学时&#xff09;计算机总线技术&#xff08;4学时&#xff09;过程通道与人机接口&#xff08;6学时&#xff09;数据处理与控制策略&#xff08;6学时&#xff09;网络与通讯技术&#xff08;3学时&#xff0…

sonarqube 生成pdf报错

sonar 生成report pdf报错&#xff0c;需要先配置username,password, Administration->PDF Report-> Password & Username https://gitee.com/zzulj/sonar-pdf-plugin sonar-pdf-plugin sonar-pdfreport-plugin-4.0.1.jar Installation 下载对应的版本&#xff…

Day894.加锁规则的一些问题 -MySQL实战

加锁规则的一些问题 Hi&#xff0c;我是阿昌&#xff0c;今天学习记录的是关于加锁规则的一些问题的内容。 加锁规则&#xff0c;这个规则中&#xff0c;包含了两个“原则”、两个“优化”和一个“bug”&#xff1a; 原则 1&#xff1a;加锁的基本单位是 next-key lock。nex…

stable-diffusion-webui 安装使用

文章目录1.github 下载&#xff0c;按教程运行2.安装python 忘记勾选加入环境变量&#xff0c;自行加入&#xff08;重启生效&#xff09;3.环境变量添加后&#xff0c;清理tmp &#xff0c;venv重新运行4.运行报错&#xff0c;无法升级pip&#xff0c;无法下载包&#xff0c;5…

如何将Python打包后的exe还原成.py?

将python打包好的exe解压为py文件&#xff0c;步骤如下&#xff1a;下载pyinstxtractor.py文件下载地址&#xff1a;https://nchc.dl.sourceforge.net/project/pyinstallerextractor/dist/pyinstxtractor.py并将pyinstxtractor.py放到和exe相同的目录文件下打开命令控制台cd 进…

No.182# 技术管理之管理任务管理

引言继前文梳理「团队建设」与「管理规划」后&#xff0c;本文梳理下技术管理的另外一块「任务管理」。走查任务管理的主要内容&#xff1a;主要内容提点任务目标量化任务的优先级拉通形成共识团队梯队建设任务进度跟踪任务完成复盘一、主要内容提点二、任务目标量化任务管理&a…

QT mp3音乐播放器实现框架,Qt鼠标事件,网络编程,QSqlite,Json解析,HTTP请求等

QT mp3音乐播放器实现框架&#xff0c;Qt鼠标事件&#xff0c;网络编程&#xff0c;QSqlite,Json解析&#xff0c;HTTP请求等框架搭建UI设计mp3.hmp3.cpp隐藏窗口标题 最大化 最小化 关闭框架搭建 .pro添加 # 网络 添加多媒体 数据库 QT network multimedia sql添加头…

C进阶:5.动态内存管理

目录 1.为什么存在动态内存分配 2.动态内存函数的介绍 2.1 malloc 和 free 2.2 calloc malloc 与 calloc的区别&#xff1a; 2.3 realloc 3.常见的动态内存错误 3.1对NULL指针的解引用操作 3.2对动态开辟空间的越界访问 3.3对非动态开辟的内存使用free释放 3.4使用f…