VirtualBox is software for creating virtual machines (VMs) and experimenting with operating systems just like on a real machine, but keeping your own intact ... So here's how to prepare a VirtualBox VM to install Ubuntu on. And we will also see how to properly install the Guest Additions ... (Oracle VM VirtualBox Extension Pack) on the Ubuntu VM.
Create Ubuntu virtual machine in VirtualBox
In VirtualBox, creating a virtual machine is relatively straightforward. Rather clear explanations guide you through each step of the creation. But some adjustments may sometimes be necessary depending on the OS installed.
To start creating the Ubuntu VM in VirtualBox, click New.
Step 1: Name the virtual machine
In the window that opens, give the virtual machine a name.
If the name chosen corresponds to the operating system (OS) to be installed, then VirtualBox will automatically select the correct Type and Version for you. Otherwise, you will have to do it manually.
Step 2: Allocate RAM to the Virtual Machine
As with a physical computer, the virtual machine needs random access memory (RAM) to function. By default, for Ubuntu, VirtualBox offers a minimum of 1 GB (1024 MB). For my part, I recommend instead to put at least 2 GB (2048 MB) or more.
But be careful to keep memory available for the host system. So don't put the cursor in the red zone ...
This setting can be changed later in Configuration> System> Motherboard.
Step 3: Create a virtual hard disk
To install the operating system, you also need a virtual hard drive. The minimum size proposed by VirtualBox for Ubuntu is 10 GB. But that may not be enough depending on what you want to do. For example installing and testing software. For my part, I double this size and allocate 20 GB to the virtual disk.
1 - Create virtual hard drive now for Ubuntu
2 - Choose the hard disk type for Ubuntu: VDI default
3 - Choice of the type of storage of the virtual disk on physical disk. Default Dynamically allocated
4 - Define the size of the virtual disk
Finally, later, if you run out of space on the virtual disk, you can always change this size.
After this step, the machine is added to the list in the VirtualBox virtual machine manager.
Configure the Ubuntu Virtual Machine in VirtualBox
Once the virtual machine is created, it is necessary to refine its configuration. To do this, select it and click on Configuration.
I will only present here the main settings to fine-tune for a basic installation.
In General, Advanced tab, you will be able to activate the shared Clipboard and Drag & Drop.
But that these are active, it is necessary to install the Guest Additions ... which we will see later in this tutorial.
In System, Motherboard tab, you can modify the size of the RAM allocated to the VM. For the other parameters, if you are just starting out, I recommend that you leave their default setting. But if you want to test an installation by emulating a UEFI BIOS, you can check Enable EFI.
And in the Processor tab, you can allocate more than one CPU to your virtual machine which will allow it to be more responsive. I recommend allocating the most available CPU to the virtual machine, but without going into the red ...
In Display, Screen tab, you can:
allocate more memory for video, up to 128MB (Recommended)
change graphics controller (from Virtualbox 6). But I recommend keeping the default VMSVGA which is intended for Linux clients.
enable 3D graphics acceleration (Recommended).
And, only if the host system is Windows, it is also possible to enable 2D acceleration.
Install Ubuntu in VirtualBox
To be able to install Ubuntu in VirtualBox, I recommend that you do it from an ISO image saved on your hard drive.
Select the Ubuntu VirtualBox and click Start to launch the VM.
So select the previously downloaded image and hit Start.
By default, the VirtualBox screen resolution is 800 × 600. However, this resolution does not correctly display all of the Ubuntu graphical installer windows. So rather than directly installing Ubuntu, I suggest that you temporarily correct this defect by changing the screen resolution in the live session. I recommend a resolution of at least 1280px for the screen width.
Access to the screen resolution settings changes depending on the Ubuntu variant used (Kubuntu, Xubuntu, Lubuntu, ...). Here is how to do it on Ubuntu 18.04 and above:
Once you have chosen your language (1), select Try Ubuntu (2).
Open System Settings through the menu at the top right.
Then go to Devices> Monitors and change the resolution to a higher one.
Then you can restart the installation by clicking on the icon provided for this purpose on the desktop or the dashboard.
And finally let yourself be guided by the indications.
Install Guest Additions… VirtualBox in the Ubuntu VM
Presentation of Guest Additions
The Guest Additions ... (VirtualBox Guest Additions) are device drivers adapted to the VirtualBox and applications that optimize and improve the virtual operating system and its performance. For example, they will allow (depending on the configuration of the VM):
improving the graphics capabilities of the virtual machine. For example: display resolution management and support for 3D graphics acceleration and if the host machine is Windows, 2D acceleration.
the bidirectional clipboard (copy / paste) between the host machine and the VM
bidirectional drag-and-drop between host machine and VM
read and write access to shared folders on the host system from the virtual machine
...
In recent versions (v5.x.x and above) the installation of VirtualBox automatically includes the installation of Oracle VM VirtualBox Extension Pack which contains the ISO image of the Guest Additions ...
Installation of Guest Additions ...
The following operations are done from the command line, so open a terminal (Ctrl + Alt + T).
But before starting the installation of Guest Additions ..., I recommend installing the latest updates that are available.
To force the search for updates, do:
sudo apt update
Then, to install them:
sudo apt upgrade
Finally, if there was a kernel update, reboot.
After that, you have to install the necessary packages to modify the kernel modules when installing the Guest Additions ....
sudo apt install dkms build-essential
So, insert the Guest Additions CD image ... through Device> Insert Guest Additions CD image ....
You can automatically start the installation if it is offered.
Otherwise, in a terminal, do:
sudo sh /path/to/cdrom/VBoxLinuxAdditions.run
/ path / to / cdrom is to be replaced by the path to the mounted CD. For example by adapting it: /media/username/VBox_GAs_X.X.X/VBoxLinuxAdditions.run.
and finally, restart.
sudo reboot
Allow access to shared folders between the host machine and the VM
In the VM configuration, you can share a folder from the host machine with the VM.
But for the user of the Ubuntu VM to be able to access it, it must be given the rights. This is done by adding the relevant account to the vboxsf group in the VM.
So, to add the current user, do:
sudo usermod -G vboxsf -a $ USER
Then, log off or restart. So, once reconnected, you will be able to access the shared folder.

Commentaires
Enregistrer un commentaire