Super detailed VirtualBox virtual machine installation and getting started tutorial

I. Introduction

虚拟机(Virtual Machine)Refers to a complete computer system that is simulated by software and has complete hardware system functions and runs in a completely isolated environment. Everything that can be done on a physical computer can be done on a virtual machine.

The virtual machine is a function that is often needed in some development and testing work. There are two common virtual machine software VMwareand VirtualBox. VMware is commercial paid software, and VirtualBox is free software. For general use, VirtualBox can basically handle most situations. This article will talk about the related content of getting started with VirtualBox.

[If you want to read articles about VMware, please see here]

2. Download and install

2.1. Download

The official website address of VirtualBox is as follows : https://www.virtualbox.org/

Image file download:

The ubuntu official website address is as follows : https://ubuntu.com/

The official website address of windows is as follows : https://www.microsoft.com/zh-cn/

The mirror address of Ali official website is as follows : https://developer.aliyun.com/mirror/

You can find the software installation package suitable for your current computer system version in Downloads and download it. After the download is complete, it can be installed by default.

insert image description here

If you need to use functions such as USB, you can download the following VirtualBox Extension Pack while downloading the VirtualBox software installation package. Note that the version of the extension package and the main software are consistent.

Support for USB 2.0 and USB 3.0 devices, VirtualBox RDP, disk encryption, NVMe and PXE boot for Intel cards

2.2. Installation

2.2.1. Then, we double-click to open the installation package, start the installation, and click the [Next] button.

insert image description here

insert image description here

2.2.2. Select the installation path

insert image description here

insert image description here

2.2.3. The default that appears later is fine, and when the installation interface appears, just click Install.

insert image description here

2.2.4. Then, wait for the final installation to complete. At this point, the installation process is over.

insert image description here

3. Use a virtual machine

3.1. ISO file download

Just like installing an operating system on a computer, you can download any operating system you need. If you want to install the Ubuntu system here, you can search directly on bing and find the official website. We use ubuntu here as a demonstration.
Ubuntu is divided into two versions a year, and the April version is relatively stable. When downloading, you can right-click to download and copy the link, then open Thunder, create a new task, and paste the link. Thunder speed is ok.

3.1.1. ISO image file download:

The ubuntu official website address is as follows : https://ubuntu.com/

The official website address of windows is as follows : https://www.microsoft.com/zh-cn/

The mirror address of Ali official website is as follows : https://developer.aliyun.com/mirror/

3.1.2, ubuntu ISO image file download

insert image description here

insert image description here

insert image description here

3.2. Create a new virtual machine

It is very simple to create a new virtual machine in VirtualBox, just determine the name of the virtual machine and the operating system to be installed, then allocate memory, and select the virtual hard disk. The memory size can be selected at will, and it can be changed if it is not enough in use later. It is best to choose dynamic allocation for the virtual hard disk, and the size can be selected larger.

insert image description here
The specific operation steps are as follows:

1. Open virtualbox, click New on the welcome page - enter a name - select the folder where the virtual machine files are placed - select the operating system type and version - next.

insert image description here

2. My choice is the ubuntu system, so I choose this way.

insert image description here

3. The allocation of memory and cpu threads should be as large as possible, as long as the indicator is in the green area. However, after the installation is complete, it is not enough and can be changed.

注意: 这里的立刻分配全额空间是指,如果不勾选的话,生成虚拟机后会随着使用时间越来越长,硬盘占用空间会越来越大,直到20g,勾选的话就是一下分配给你20g,直接分配会占用更多内存,但硬盘性能会更好一点。

insert image description here

4. Next, do not set the hard disk first, and directly next.

insert image description here

5. finish. This is the list of equipment we purchased. The whole machine has been assembled, although there is no system in it.

insert image description here
insert image description here

3.3. Create media

3.3.1, configure the hard disk

3.3.1.1. Select: Tool - Medium.

insert image description here

3.3.1.2. Select virtual hard disk - create

insert image description here

3.3.1.3. Select a format.

VDI:是virtual box 的原生格式
VMDK:是VMware给他开发的,在Sun xVM, QEMU, VirtualBox, SUSE Studio, .NET DiscUtils 也支持
VHD:是Microsoft Virtual PC的原生格式,在微软产品比较流行

All three above support dynamic storage allocation. VMDK can also split storage files into smaller than 2GB, which is useful when your file system's file size limit is relatively small

insert image description here

3.3.1.4, fixed size installation

insert image description here

3.3.1.5. Select the storage location of the hard disk. I usually put it in the folder of the virtual machine that uses the hard disk

insert image description here

3.3.1.6. Created successfully

insert image description here

insert image description here

3.4. Setting up the virtual machine

3.4.1. Click on your own virtual machine - Settings - Storage

insert image description here

insert image description here

Add an optical drive to the ide controller, which is the operating system iso file we downloaded. It will start from the iso when it will start, and it will not boot if it is not set.

At boot it will restart as follows:

insert image description here

3.4.2. Registration - choose the iso file you want to install - OK

insert image description here

insert image description here
insert image description here

3.4.3. Add hard disk

Add the hard disk we just set up to the sata controller, and the system in the iso will be written into the hard disk later, if not, it will say that the installation cannot find the hard disk, and you have to exit to reconfigure.
Because the virtual hard disk has just been created, it can be selected directly now. If you cannot find the virtual hard disk file given by others here, you can register it, or click Create if you haven’t created it yet.

insert image description here
Store the configuration here like this

insert image description here

3.4.4. System Settings

System, you can see that there is a boot sequence here, that is to say, when starting up, check whether there is a system in it according to the order of floppy disk-CD-drive-hard disk, and if there is, it will boot into the system on that disk, just like the fashion system , to choose boot disk priority boot,

insert image description here
The operating system we downloaded just now is an iso file with a CD-ROM drive, so we need to put the CD-ROM drive first, and floppy disks are not used by many people now, so we set the boot sequence like this.

insert image description here

3.5. Start the virtual machine

Before starting the virtual machine for the first time, you must prepare an installation CD image of the operating system to be installed. Here I use the Ubuntu system. I downloaded the latest LTS of Ubuntu Desktop on
its official website: https://ubuntu.com/download
tab The version system installs mirror files.
Next, you can start the virtual machine for the first time:

insert image description here
Starting a virtual machine for the first time is basically equivalent to installing an operating system on a new computer, which is quite slow. For virtual machines, it is even slower by default, so be patient. There are several ways to improve the system installation speed (the same is true for the virtual machine running speed), first use a solid state drive; then select the created virtual machine before starting, and open the settings. In the system tab of the settings, set the memory and the number of processors to be larger, and in the display tab, set the video memory to be larger. The number of processors and memory can usually be opened to about half of the actual resources of the computer, and if it is larger, it may degrade performance. It should be noted that the number of processors may affect the stability of the operation. It is best to choose even numbers, such as 2, 4, and 8.

The specific operation steps are as follows:

3.5.1, choose to start

insert image description here

3.5.2. Select the first one and press Enter directly.

insert image description here

3.5.3, formally enter the installation program

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

3.5.4. Waiting

insert image description here
insert image description here
insert image description here
insert image description here

3.5.5. It is best to update here once. I don’t know why after not updating here, some software will encounter trouble when installing later.

insert image description here
insert image description here

3.5.6. It seems to be the same after replacing /etc/apt/source.list

insert image description here

3.6. Install enhanced functions

3.6.1. Devices - Installation Enhancements

insert image description here
insert image description here
insert image description here

sudo chmod +x autorun.sh
./autorun.sh

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

注意: 在这里就可以设置一下,给这个虚拟机设置一个快照(备份或是还原点了),弄坏了可以不用重新装了。还有个很重要的地方,要在windows 安全中心关闭内核隔离,不知道为啥,这个内核隔离有时候会让我恢复备份的时候提示某一块内存不可写,导致备份恢复失败

insert image description here

3.7, modify the resolution

Then you can adjust the resolution from View > Virtual Display in the interface.

insert image description here

3.8. Using USB devices

To use a USB device, you first need to install the VirtualBox Extension Pack mentioned in the previous download and installation:

insert image description here

Then enable the USB controller in Settings > USB Device when the virtual machine is shut down. This USB controller needs to be selected according to your computer and device. Now the common one is 3.0. If there are problems in the later process, you can Try again with 2.0. After completing the settings, you can start the virtual machine and select the USB device that has been plugged into the computer from Device > USB on the interface:

insert image description here
The above opened my U disk. (My U disk just happened to be named UBUNTU)

3.9. Display menu

The VirtualBox virtual machine may hide the menu bar in some modes. At this time, by default, just press Ctrl + Home on the right to display the menu.
insert image description here

3.10. Shared pasteboard and file drag and drop

The virtual machine can enable the shared clipboard and file drag and drop in Settings > General > Advanced, so that data exchange between the native system and the virtual machine will be convenient:

insert image description here
These functions may not work well on the desktop of the virtual machine, but they are fine in the folder.

3.11. Performance adjustment

The performance of the virtual machine is mainly related to the allocated memory, the number of processors, and video memory, which can be adjusted directly in the settings:

insert image description here

3.12. Network adjustment

By default, the virtual machine network established by VirtualBox is in Network Address Translation (NAT) mode . In this mode, the virtual machine can access various networks that the host can access, but the host and external devices cannot access the virtual machine through IP:

insert image description here
The virtual machine can change the network mode to bridge network card mode in Settings > Network, then the virtual machine will be connected to the local area network where the host is located, and become a device at the same level as the host, and can access each other through IP and access the external network:

insert image description here
In the above demonstration, my host cannot be pinged due to firewall permission issues, so the form of accessing the web page with a browser in the virtual machine proves that it can access the external network. In fact, the most important thing is that you can see that the host and the virtual machine are already on the same network segment in the bridge network card mode.

3.13, network shared folder

The virtual machine can set up a shared folder in Settings > Shared Folder. This function can facilitate file transfer between the host and the virtual machine:

insert image description here
The shared folder data vboxsf user group created by VirtualBox needs to be added to the reorganization group to access; use the sudo usermod -a -G vboxsf username command to add yourself to the vboxsf user group.

Permanently allocated shared folders are not affected by the virtual machine power on and off, and will always exist in the host; while temporarily allocated shared folders can only be set when the virtual machine is powered on, and will be automatically deleted after the virtual machine is powered off.

3.14. Snapshot

VirtualBox has a snapshot function, which can easily create a snapshot of a virtual machine, so that the system can roll back to the state when a certain snapshot was created:

insert image description here

3.15. Export and import

VirtualBox supports virtual export and import functions to facilitate migration between different devices:

insert image description here

Guess you like

Origin blog.csdn.net/GoodburghCottage/article/details/130307152