Language: EN

raspberry-pi-virtualbox

Emulating Raspberry Pi on a Virtual Machine with VirtualBox

In this post we are going to see how to emulate a Raspberry Pi with Raspbian in a virtual machine using Oracle VM VirtualBox

Emulating a Raspberry Pi in a virtual machine can be useful, for example, for testing without having a physical Raspberry available, or for experimenting in a controlled environment before deploying it on the real machine.

It should also be said that, although in recent times the virtualization of a Raspberry Pi has been greatly simplified (before it was almost impossible), with the release of Raspberry Pi Desktop, the image still has limitations compared to having a real Raspberry Pi running.

In any case, it is very simple and does not take up much space on the hard drive, so if you are going to work frequently with Raspberry Pi, it is useful to have a virtual machine on the computer for testing and experiments.

Create the virtual machine

First, download and install the latest version of Virtual Box from https://www.virtualbox.org/

On the other hand, download the latest version of Raspberry Pi Desktop from https://www.raspberrypi.org/downloads/raspberry-pi-desktop/.

raspberry-pi-virtual-box-1

Launch Virtual Box and add a new machine.

raspberry-pi-virtual-box-2

Put a name to our machine, for example “RaspberryPi”, and select type “Linux”, version “Other Linux”.

raspberry-pi-virtual-box-3

Increase the memory size to 512 Mb.

raspberry-pi-virtual-box-4

Now we have to create a virtual hard disk, where the machine’s files will be stored. Choose “create a new virtual hard disk”.

raspberry-pi-virtual-box-5

Leave the default type of hard drive.

raspberry-pi-virtual-box-6

Now choose whether you want the size to be dynamically allocated, or fixed size. If it is a dynamic size, the virtual hard disk file will only be the size of the space actually occupied on the virtual machine. But in return, the performance will be lower when it has to expand the size. If we choose a fixed size, the performance will be higher, but the virtual hard disk file will always occupy the maximum size of the virtual hard disk.

We can choose dynamically allocated.

raspberry-pi-virtual-box-7

Choose a name for the virtual hard disk file, for example “RaspberryPi”, and choose a size between 8Gb - 16Gb. In general, 8Gb is going to be more than enough.

raspberry-pi-virtual-box-8

We already have our virtual machine created. Now, double click to start it.

Installing Rasperry Pi Desktop

The first time we start it, it will ask us to insert an image as a virtual installation CD of the OS. Choose the image we downloaded in the first step.

raspberry-pi-virtual-box-9

Choose “Graphic install” and follow the steps of the installer, leaving the options it offers us by default.

raspberry-pi-virtual-box-10

At the end of the process our virtual machine with Raspberry Pi will start, and we are ready to start playing and experimenting with it.

raspberry-pi-virtual-box-12